feat: implement admin authentication context and update related procedures and tokens

This commit is contained in:
2026-01-03 15:44:27 +00:00
parent e5bd6d89ab
commit 95f263785a
7 changed files with 257 additions and 52 deletions
+4 -4
View File
@@ -1,11 +1,11 @@
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../../../gateway-api/src/router';
const getAdminToken = (): string | null => {
const getSessionToken = (): string | null => {
if (typeof window === 'undefined') {
return null;
}
return window.localStorage.getItem('sammo-admin-token');
return window.localStorage.getItem('sammo-session-token');
};
export const trpc = createTRPCProxyClient<AppRouter>({
@@ -13,8 +13,8 @@ export const trpc = createTRPCProxyClient<AppRouter>({
httpBatchLink({
url: '/api/trpc', // 실제 환경에 맞게 조정 필요
headers() {
const token = getAdminToken();
return token ? { 'x-admin-token': token } : {};
const token = getSessionToken();
return token ? { 'x-session-token': token } : {};
},
}),
],