/api/auth 아래의 Endpoint들을 tRPC로 마이그레이션

This commit is contained in:
static
2025-12-25 23:44:23 +09:00
parent b92b4a0b1b
commit 3fc29cf8db
15 changed files with 214 additions and 286 deletions

View File

@@ -1,5 +1,4 @@
import { callPostApi } from "$lib/hooks";
import type { LoginRequest } from "$lib/server/schemas";
import { useTRPC } from "$trpc/client";
export { requestLogout } from "$lib/services/auth";
export { requestDeletedFilesCleanup } from "$lib/services/file";
@@ -9,6 +8,13 @@ export {
} from "$lib/services/key";
export const requestLogin = async (email: string, password: string) => {
const res = await callPostApi<LoginRequest>("/api/auth/login", { email, password });
return res.ok;
const trpc = useTRPC();
try {
await trpc.auth.login.mutate({ email, password });
return true;
} catch {
// TODO: Error Handling
return false;
}
};