From 567dd1485853383e7adcba7cafb7c05439c49008 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Fri, 30 Jan 2026 18:53:40 -0700 Subject: [PATCH] Redirect if not logged in --- src/app/account/page.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx index f922196..05f2fdd 100644 --- a/src/app/account/page.tsx +++ b/src/app/account/page.tsx @@ -3,15 +3,30 @@ import { HomeButton } from '@/app/components/HomeButton' import { DiscordButton } from '@/app/components/DiscordButton' import { getCookie } from '@/util/cookie' +import { useEffect, useState } from 'react' +import { useRouter } from 'next/navigation' export default function AccountLoginPage () { + const [loading, setLoading] = useState(true) + const router = useRouter() + + useEffect(() => { + const token = getCookie('accountToken', '-1') + if (token === '-1') { + router.push('/account/login') + } else setLoading(false) + }, [router]) + return (

- Nothing on this page yet! You are logged in as{' '} - {getCookie('accountUsername', 'N/A')}. + {loading + ? 'Loading...' + : 'Nothing on this page yet! You are logged in as ' + + getCookie('accountUsername', 'N/A') + + '.'}

)