mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
Access Token 유무에 따른 자동 리다이렉트 구현
This commit is contained in:
13
src/routes/(fullscreen)/auth/login/+page.server.ts
Normal file
13
src/routes/(fullscreen)/auth/login/+page.server.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
import type { PageServerLoad } from "./$types";
|
||||
|
||||
export const load: PageServerLoad = async ({ url, cookies }) => {
|
||||
const redirectPath = url.searchParams.get("redirect") || "/";
|
||||
|
||||
const accessToken = cookies.get("accessToken");
|
||||
if (accessToken) {
|
||||
redirect(302, redirectPath);
|
||||
}
|
||||
|
||||
return { redirectPath };
|
||||
};
|
||||
Reference in New Issue
Block a user