feat: 구글 소셜로그인 백엔드 연결
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
/**
|
||||
* VibeRoom 공통 API 클라이언트
|
||||
* 환경 변수(NEXT_PUBLIC_API_BASE_URL)를 기반으로 자동으로 Base URL이 설정됩니다.
|
||||
*
|
||||
*
|
||||
* - npm run dev 실행 시: https://api-dev.viberoom.io (from .env.development)
|
||||
* - 빌드 후 운영 환경: https://api.viberoom.io (from .env.production)
|
||||
*/
|
||||
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8080';
|
||||
const API_BASE_URL =
|
||||
process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8080";
|
||||
|
||||
export const apiClient = async <T>(
|
||||
endpoint: string,
|
||||
options: RequestInit = {}
|
||||
options: RequestInit = {},
|
||||
): Promise<T> => {
|
||||
// 엔드포인트 앞의 슬래시(/) 중복 방지
|
||||
const url = `${API_BASE_URL}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`;
|
||||
|
||||
const url = `${API_BASE_URL}${endpoint.startsWith("/") ? endpoint : `/${endpoint}`}`;
|
||||
|
||||
const defaultHeaders = {
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
const response = await fetch(url, {
|
||||
|
||||
Reference in New Issue
Block a user