mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
암호 키 생성 페이지 레이아웃 구현
This commit is contained in:
21
src/routes/(fullscreen)/auth/login/service.ts
Normal file
21
src/routes/(fullscreen)/auth/login/service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { callAPI } from "$lib/hooks";
|
||||
import { accessToken } from "$lib/stores/auth";
|
||||
|
||||
export const requestLogin = async (email: string, password: string) => {
|
||||
const res = await callAPI("/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ email, password }),
|
||||
});
|
||||
if (!res.ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
const token = data.accessToken as string;
|
||||
|
||||
accessToken.set(token);
|
||||
return true;
|
||||
};
|
||||
Reference in New Issue
Block a user