diff --git a/.biome.jsonc b/.biome.jsonc index 226808c..82668c5 100644 --- a/.biome.jsonc +++ b/.biome.jsonc @@ -34,6 +34,16 @@ "include": ["server/src/lib/verify.ts"], "linter": { "rules": { "style": { "noUnusedTemplateLiteral": "off", "useTemplate": "off" } } }, }, + { + "include": ["client/src/components/withAuth.tsx"], + "linter": { + "rules": { + "correctness": { + "useExhaustiveDependencies": "off", + }, + }, + }, + }, ], "vcs": { "enabled": true, diff --git a/client/src/app/x/page.tsx b/client/src/app/x/page.tsx index 85642da..d8bb8c9 100644 --- a/client/src/app/x/page.tsx +++ b/client/src/app/x/page.tsx @@ -1,20 +1,23 @@ -export default function X() { - return ( -
(Component: ComponentType
) => {
+ return function WithAuth(props: P) {
+ const { auth, loading } = useAuthorized()
+ const router = useRouter()
+ useEffect(() => {
+ if (auth === false) {
+ alert('Nice try! But we need to verify your age first.')
+ router.push('/login')
+ }
+ }, [loading])
+ if (auth === false || loading === true)
+ return null
+
+ return