Skip to content

Commit 6ff14b6

Browse files
committed
fix(payments): Fix sign-out navigation showing blank
Because: - Sign-out was using client-side navigation via `router.replace()` after calling `signOut()` with `redirect: false`, which failed to properly re-render the new page in staging, showing users a blank screen This commit: - Lets next-auth handle the redirect automatically for proper page reload and session state cleanup Closes #PAY-3639
1 parent 9108677 commit 6ff14b6

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

  • libs/payments/ui/src/lib/client/components/Header

libs/payments/ui/src/lib/client/components/Header/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { OFFERING_LINKS } from '../../../constants';
2727
import {
2828
ReadonlyURLSearchParams,
2929
useParams,
30-
useRouter,
3130
useSearchParams,
3231
} from 'next/navigation';
3332
import { signOut } from 'next-auth/react';
@@ -68,7 +67,6 @@ type HeaderProps = {
6867
};
6968

7069
export const Header = ({ auth, cart, redirectPath }: HeaderProps) => {
71-
const router = useRouter();
7270
const params = useParams();
7371
const searchParams = useSearchParams();
7472

@@ -389,9 +387,8 @@ export const Header = ({ auth, cart, redirectPath }: HeaderProps) => {
389387
<div className="bg-gradient-to-r from-blue-500 via-pink-700 to-yellow-500 h-px" />
390388
<div className="px-4 py-5">
391389
<button
392-
onClick={async () => {
393-
const signOutRedirect = await signOut({ redirectTo: signOutRedirectPath, redirect: false })
394-
router.replace(signOutRedirect.url);
390+
onClick={() => {
391+
signOut({ redirectTo: signOutRedirectPath })
395392
}}
396393
className="pl-3 group"
397394
>

0 commit comments

Comments
 (0)