From 9706fee07bbe0fae41667d6a22a9b6fbf4bc505b Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 5 Mar 2024 12:48:23 +0800 Subject: [PATCH] New function to verify auth --- packages/web/components/templates/PrimaryLayout.tsx | 2 ++ packages/web/lib/hooks/useVerifyAuth.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 packages/web/lib/hooks/useVerifyAuth.tsx diff --git a/packages/web/components/templates/PrimaryLayout.tsx b/packages/web/components/templates/PrimaryLayout.tsx index d05103af8..c7fff4d4f 100644 --- a/packages/web/components/templates/PrimaryLayout.tsx +++ b/packages/web/components/templates/PrimaryLayout.tsx @@ -14,6 +14,7 @@ import { useApplyLocalTheme } from '../../lib/hooks/useApplyLocalTheme' import { updateTheme } from '../../lib/themeUpdater' import { Priority, useRegisterActions } from 'kbar' import { ThemeId } from '../tokens/stitches.config' +import { useVerifyAuth } from '../../lib/hooks/useVerifyAuth' type PrimaryLayoutProps = { children: ReactNode @@ -25,6 +26,7 @@ type PrimaryLayoutProps = { } export function PrimaryLayout(props: PrimaryLayoutProps): JSX.Element { + useVerifyAuth() useApplyLocalTheme() const { viewerData } = useGetViewerQuery() diff --git a/packages/web/lib/hooks/useVerifyAuth.tsx b/packages/web/lib/hooks/useVerifyAuth.tsx new file mode 100644 index 000000000..745c50ee3 --- /dev/null +++ b/packages/web/lib/hooks/useVerifyAuth.tsx @@ -0,0 +1,13 @@ +import { useEffect } from 'react' +import { useRouter } from 'next/router' + +export function useVerifyAuth() { + const router = useRouter() + + useEffect(() => { + if (window.localStorage.getItem('authVerified')) { + console.log('not verified') + return + } + }, [router]) +}