Skip to content

Commit 4e6cafa

Browse files
committed
fix: resolve error if redirect to homepage after sign-in
1 parent f6ab6bb commit 4e6cafa

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/app/[locale]/(auth)/account/signin/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ const Page = () => {
4949
const getCallbackUrl = () => {
5050
const callbackUrl =
5151
new URL(location.href).searchParams.get('callbackUrl') || '/';
52-
53-
const url = new URL(callbackUrl || '/');
52+
const url = new URL(callbackUrl, window.location.origin);
5453
return url.pathname + url.search + url.hash;
5554
};
5655

src/components/Header/components/TopSection.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const TopSection: FC = () => {
5252

5353
const pathname = usePathname();
5454
const searchParams = useSearchParams();
55-
const callbackUrl = `${pathname}?${searchParams.toString()}`;
55+
const callbackUrl = `${pathname}${
56+
searchParams.toString() ? `?${searchParams.toString()}` : ''
57+
}`;
5658

5759
return (
5860
<>

0 commit comments

Comments
 (0)