diff --git a/web/pages/create.tsx b/web/pages/create.tsx index e4cba4e0..ebbb6f65 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -26,6 +26,7 @@ import { useWarnUnsavedChanges } from 'web/hooks/use-warn-unsaved-changes' import { track } from 'web/lib/service/analytics' import { GroupSelector } from 'web/components/groups/group-selector' import { CATEGORIES } from 'common/categories' +import { User } from 'common/user' export default function Create() { const [question, setQuestion] = useState('') @@ -33,7 +34,13 @@ export default function Create() { const router = useRouter() const { groupId } = router.query as { groupId: string } useTracking('view create page') - if (!router.isReady) return
+ const creator = useUser() + + useEffect(() => { + if (creator === null) router.push('/') + }, [creator, router]) + + if (!router.isReady || !creator) return return (