tRPC Endpoint를 /api/trpc로 변경

This commit is contained in:
static
2025-12-25 20:22:58 +09:00
parent 208252f6b2
commit a08ddf2c09
3 changed files with 4 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ import { authenticate, AuthenticationError } from "$lib/server/modules/auth";
export const authenticateMiddleware: Handle = async ({ event, resolve }) => { export const authenticateMiddleware: Handle = async ({ event, resolve }) => {
const { pathname, search } = event.url; const { pathname, search } = event.url;
if (pathname === "/api/auth/login" || pathname.startsWith("/trpc")) { if (pathname === "/api/auth/login") {
return await resolve(event); return await resolve(event);
} }
@@ -24,7 +24,7 @@ export const authenticateMiddleware: Handle = async ({ event, resolve }) => {
}); });
} catch (e) { } catch (e) {
if (e instanceof AuthenticationError) { if (e instanceof AuthenticationError) {
if (pathname === "/auth/login") { if (pathname === "/auth/login" || pathname.startsWith("/api/trpc")) {
return await resolve(event); return await resolve(event);
} else if (pathname.startsWith("/api")) { } else if (pathname.startsWith("/api")) {
error(e.status, e.message); error(e.status, e.message);

View File

@@ -5,7 +5,7 @@ import type { RequestHandler } from "./$types";
const trpcHandler: RequestHandler = (event) => const trpcHandler: RequestHandler = (event) =>
fetchRequestHandler({ fetchRequestHandler({
endpoint: "/trpc", endpoint: "/api/trpc",
req: event.request, req: event.request,
router: appRouter, router: appRouter,
createContext: () => createContext(event), createContext: () => createContext(event),

View File

@@ -6,7 +6,7 @@ const createClient = (fetch: typeof globalThis.fetch) =>
createTRPCClient<AppRouter>({ createTRPCClient<AppRouter>({
links: [ links: [
httpBatchLink({ httpBatchLink({
url: "/trpc", url: "/api/trpc",
fetch, fetch,
}), }),
], ],