blob: 49474c36abc550267ce7716739420ba2eeaa1655 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { auth, get } from "$lib/utils";
import { redirect } from "@sveltejs/kit";
export async function GET({ cookies }) {
let token = cookies.get("token");
let user;
if (token) {
user = await get("/me", auth(cookies));
throw redirect(307, `/${user.username}`);
}
throw redirect(307, "/");
}
|