/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

@@ -3,11 +3,6 @@ import env from "$lib/server/loadenv";
import { authenticate, AuthenticationError } from "$lib/server/modules/auth";
export const authenticateMiddleware: Handle = async ({ event, resolve }) => {
const { pathname, search } = event.url;
if (pathname === "/api/auth/login") {
return await resolve(event);
}
try {
const sessionIdSigned = event.cookies.get("sessionId");
if (!sessionIdSigned) {
@@ -24,6 +19,7 @@ export const authenticateMiddleware: Handle = async ({ event, resolve }) => {
});
} catch (e) {
if (e instanceof AuthenticationError) {
const { pathname, search } = event.url;
if (pathname === "/auth/login" || pathname.startsWith("/api/trpc")) {
return await resolve(event);
} else if (pathname.startsWith("/api")) {