서비스를 이용하려면 로그인을 해야해요.
-
+
계정이 없어요
diff --git a/src/routes/(fullscreen)/login/service.ts b/src/routes/(fullscreen)/login/service.ts
new file mode 100644
index 0000000..4799ea5
--- /dev/null
+++ b/src/routes/(fullscreen)/login/service.ts
@@ -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;
+};