diff --git a/apps/web/src/components/AuthForm.tsx b/apps/web/src/components/AuthForm.tsx index f80fd0360..6f9726a32 100644 --- a/apps/web/src/components/AuthForm.tsx +++ b/apps/web/src/components/AuthForm.tsx @@ -2,10 +2,7 @@ import Link from 'next/link' import { Auth } from '@supabase/auth-ui-react' -import { - ThemeSupa, - ViewType, -} from '@supabase/auth-ui-shared' +import { ThemeSupa, ViewType } from '@supabase/auth-ui-shared' import { createClientComponentClient } from '@supabase/auth-helpers-nextjs' import { useSearchParams, useRouter } from 'next/navigation' import { useEffect } from 'react' @@ -20,19 +17,22 @@ export interface Props { function AuthForm({ view }: Props) { const searchParams = useSearchParams() - const redirectTo = searchParams?.get('redirect_to') || undefined + const redirectTo = searchParams?.get('redirect_to') || '/dashboard' const router = useRouter() const user = useUser() - useEffect(function redirect() { - if (user.user && redirectTo) { - router.push(redirectTo) - } + useEffect( + function redirect() { + if (user.user && redirectTo) { + router.push(redirectTo) + } - if (user.wasUpdated && !redirectTo) { - router.push('/dashboard') - } - }, [user.user, router, redirectTo, view, user.wasUpdated]) + if (user.wasUpdated && !redirectTo) { + router.push('/dashboard') + } + }, + [user.user, router, redirectTo, view, user.wasUpdated] + ) return (
@@ -79,43 +79,36 @@ function AuthForm({ view }: Props) {
- {(view === 'sign_up' || view === 'forgotten_password' || view === 'update_password') && + {(view === 'sign_up' || + view === 'forgotten_password' || + view === 'update_password') && (
Already have an account? - - + +
- } + )} - {view === 'sign_in' && + {view === 'sign_in' && ( - + - } + )} - {view === 'sign_in' && + {view === 'sign_in' && (
- {'Don\'t have an account?'} + {"Don't have an account?"} - +
- } + )}
- + ) } diff --git a/apps/web/src/pages/_404/[...path].tsx b/apps/web/src/pages/_404/[...path].tsx index ea507a364..3be8c9c6f 100644 --- a/apps/web/src/pages/_404/[...path].tsx +++ b/apps/web/src/pages/_404/[...path].tsx @@ -4,7 +4,7 @@ import { GetServerSideProps } from 'next' export const getServerSideProps: GetServerSideProps = async () => { return { redirect: { - destination: '/dashboard', + destination: '/', permanent: false, }, }