bug: fix sign-in when returnTo=sign-in (#24893)

* bug: fix sign-in when returnTo=sign-in

- default redirect to /projects instead

* Update apps/studio/components/interfaces/SignIn/SignInForm.tsx

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
This commit is contained in:
Simon HaandAlaister Young authored and GitHub committed 2024-05-06 17:38:39 +10:00
1 parent e676a18b6c
commit 203d9e4c1e
1 file changed
+3 -2
@@ -52,8 +52,9 @@ const SignInForm = () => {
toast.success(`Signed in successfully!`, { id: toastId })
await queryClient.resetQueries()
router.push(getReturnToPath())
const returnTo = getReturnToPath()
// since we're already on the /sign-in page, prevent redirect loops
router.push(returnTo === '/sign-in' ? '/projects' : returnTo)
} catch (error) {
toast.error((error as AuthError).message, { id: toastId })
}