Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use server';

import { ERROR_MESSAGES } from '@/src/shared/services/models';
import type {
HttpMethod,
Expand All @@ -8,6 +10,7 @@ import type {
ApiServerType,
} from '@/src/shared/services/models';
import { getBaseUrl } from '@/src/shared/services/lib/utils';
import { cookies } from 'next/headers';

export async function fetchInstance<TResponse, TBody = JsonValue>(
serverType: ApiServerType,
Expand All @@ -16,9 +19,7 @@ export async function fetchInstance<TResponse, TBody = JsonValue>(
options: FetchOptions<TBody> = {},
): Promise<TResponse> {
try {
// 🟢 브라우저 환경에서만 localStorage 접근
const token =
typeof window !== 'undefined' ? localStorage.getItem('token') : null;
const token = cookies().get('token')?.value;

// 🟢 options 객체에서 필요한 값들을 구조 분해 할당
const {
Expand Down