feat: update cookie paths for staff authentication and implement redirect logic in admin login

This commit is contained in:
Ardeman
2025-03-03 17:48:24 +08:00
parent 599a92fba3
commit 5007b8d4db
3 changed files with 15 additions and 2 deletions
@@ -1,4 +1,17 @@
import { redirect } from 'react-router'
import { handleCookie } from '~/libs/cookies'
import { AdminLoginPage } from '~/pages/admin-login'
import type { Route } from './+types/_admin.lg-admin._auth.login'
export const loader = async ({ request }: Route.LoaderArgs) => {
const { staffToken } = await handleCookie(request)
if (staffToken) {
throw redirect('/lg-admin')
}
}
const AuthLayout = () => <AdminLoginPage />
export default AuthLayout