diff --git a/client/pages/new.tsx b/client/pages/new.tsx index 85256704..d3dbad6b 100644 --- a/client/pages/new.tsx +++ b/client/pages/new.tsx @@ -5,10 +5,14 @@ import { Loading, Page } from '@geist-ui/core' import useSignedIn from '../lib/hooks/use-signed-in' import Header from '../components/header' import { ThemeProps } from './_app' +import { useRouter } from 'next/router' const Home = ({ theme, changeTheme }: ThemeProps) => { + const router = useRouter() const { isSignedIn, isLoading } = useSignedIn({ redirectIfNotAuthed: true }) - + if (!isSignedIn && !isLoading) { + router.push("/signin") + } return ( @@ -22,7 +26,6 @@ const Home = ({ theme, changeTheme }: ThemeProps) => { - {isLoading && } {isSignedIn && }