Skip to content

Commit b7ee1d3

Browse files
authored
Merge pull request #39 from codeunia-dev/updatereturnurl
Refactor: Update returnUrl handling in OAuth callback and SignIn form
2 parents d348622 + 307412a commit b7ee1d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/auth/callback/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { toast } from "sonner";
88
function OAuthCallbackContent() {
99
const router = useRouter();
1010
const searchParams = useSearchParams();
11-
const returnUrl = searchParams.get("returnUrl") || "/protected";
11+
const returnUrl = searchParams.get("returnUrl") || "/";
1212

1313
useEffect(() => {
1414
const checkSession = async () => {

app/auth/signin/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function SignInForm() {
3232
})
3333

3434
// Get the return URL from query parameters
35-
const returnUrl = searchParams.get('returnUrl') || '/protected'
35+
const returnUrl = searchParams.get('returnUrl') || '/'
3636

3737
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
3838
const { name, value, type, checked } = e.target
@@ -79,7 +79,7 @@ function SignInForm() {
7979
provider: 'google',
8080
options: {
8181
redirectTo: typeof window !== "undefined"
82-
? `${window.location.origin}/protected`
82+
? `${window.location.origin}/auth/callback?returnUrl=${encodeURIComponent(returnUrl)}`
8383
: undefined,
8484
},
8585
});

0 commit comments

Comments
 (0)