Access Token 저장 방식 변경

This commit is contained in:
static
2024-12-28 16:54:46 +09:00
parent 1d0c309878
commit c09a0b4aa0
10 changed files with 44 additions and 83 deletions

View File

@@ -1,5 +1,3 @@
import { accessTokenStore } from "$lib/stores";
export const requestLogin = async (email: string, password: string) => {
const res = await fetch("/api/auth/login", {
method: "POST",
@@ -8,13 +6,5 @@ export const requestLogin = async (email: string, password: string) => {
},
body: JSON.stringify({ email, password }),
});
if (!res.ok) {
return false;
}
const data = await res.json();
const token = data.accessToken as string;
accessTokenStore.set(token);
return true;
return res.ok;
};