mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 16:16:55 +00:00
백엔드에서 JWT가 아닌 세션 ID 기반으로 인증하도록 변경
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { authenticate } from "$lib/server/modules/auth";
|
||||
import { json } from "@sveltejs/kit";
|
||||
import { authorize } from "$lib/server/modules/auth";
|
||||
import { clientListResponse, type ClientListResponse } from "$lib/server/schemas";
|
||||
import { getUserClientList } from "$lib/server/services/client";
|
||||
import type { RequestHandler } from "./$types";
|
||||
|
||||
export const GET: RequestHandler = async ({ cookies }) => {
|
||||
const { userId, clientId } = authenticate(cookies);
|
||||
if (!clientId) {
|
||||
error(403, "Forbidden");
|
||||
}
|
||||
|
||||
export const GET: RequestHandler = async ({ locals }) => {
|
||||
const { userId } = await authorize(locals, "anyClient");
|
||||
const { userClients } = await getUserClientList(userId);
|
||||
return json(clientListResponse.parse({ clients: userClients } satisfies ClientListResponse));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user