Skip to content

Commit be55022

Browse files
authoredFeb 16, 2023
Merge pull request #38 from raja-poudel/main
Fixed redirect back to the public page after sign in
2 parents 2991283 + 164f675 commit be55022

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/components/AuthProvider.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export function AuthProvider({ children }: { children: JSX.Element }) {
5252
*/
5353
useEffect(() => {
5454
auth.resolveUser(2000).onAuthStateChanged((user: User, error) => {
55-
console.log("auth state changed ", user)
5655
if (user) {
5756
setUser(user)
5857
setError(null)

‎src/pages/signin.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ export default function SignIn() {
2828
if (!initializing) {
2929
if (user) {
3030
const redirect = getRedirect()
31-
if (redirect) {
31+
console.log("redirect: ", redirect)
32+
if (redirect !== null) {
3233
router.push(redirect) // go to page which redirected to login
3334
clearRedirect()
3435
} else {
35-
router.push("/protected") // go to default protected page
36+
router.back() // go to previous page
3637
}
3738
}
3839
}

1 commit comments

Comments
 (1)

vercel[bot] commented on Feb 16, 2023

@vercel[bot]
Please sign in to comment.