diff --git a/apps/web/pages/auth/logout.tsx b/apps/web/pages/auth/logout.tsx index 43990d6eff..b0f5d87d20 100644 --- a/apps/web/pages/auth/logout.tsx +++ b/apps/web/pages/auth/logout.tsx @@ -1,7 +1,7 @@ import type { GetServerSidePropsContext } from "next"; import { signOut, useSession } from "next-auth/react"; import { useRouter } from "next/navigation"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { WEBSITE_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -18,6 +18,7 @@ import { ssrInit } from "@server/lib/ssr"; type Props = inferSSRProps; export function Logout(props: Props) { + const [btnLoading, setBtnLoading] = useState(false); const { status } = useSession(); if (status === "authenticated") signOut({ redirect: false }); const router = useRouter(); @@ -35,6 +36,11 @@ export function Logout(props: Props) { return "hope_to_see_you_soon"; }; + const navigateToLogin = () => { + setBtnLoading(true); + router.push("/auth/login"); + }; + return (
@@ -50,7 +56,11 @@ export function Logout(props: Props) {
-
diff --git a/apps/web/playwright/login.e2e.ts b/apps/web/playwright/login.e2e.ts index 13f0cdd049..94569128f8 100644 --- a/apps/web/playwright/login.e2e.ts +++ b/apps/web/playwright/login.e2e.ts @@ -35,7 +35,7 @@ test.describe("user can login & logout succesfully", async () => { const signOutBtn = await page.locator(`text=${signOutLabel}`); await signOutBtn.click(); - await page.locator('a[href="/auth/login"]').click(); + await page.locator("[data-testid=logout-btn]").click(); // Reroute to the home page to check if the login form shows up await expect(page.locator(`[data-testid=login-form]`)).toBeVisible();