diff --git a/api/news/apis.ts b/api/news/apis.ts index 4a6a93f..6684d27 100644 --- a/api/news/apis.ts +++ b/api/news/apis.ts @@ -1,10 +1,10 @@ // news-detail +const BASE_URL = process.env.NEXT_PUBLIC_API_KEY; export const getNewsDetail = async ( artcSeq: string ): Promise => { const queryparam = artcSeq ? `newsdetail?artcSeq=${artcSeq}` : ""; - - const url = `/api/article/${queryparam}`; + const url = `http://${BASE_URL}/api/article/${queryparam}`; const res = await fetch(url); if (!res.ok) { diff --git a/api/player/apis.ts b/api/player/apis.ts index b3298fa..1ee50fb 100644 --- a/api/player/apis.ts +++ b/api/player/apis.ts @@ -5,9 +5,10 @@ import { PitcherResponse, } from "./types"; +const BASE_URL = process.env.NEXT_PUBLIC_API_KEY; // player - 코치 리스트 export const getCoachList = async (): Promise => { - const url = `/api/player/coachlist`; + const url = `http://${BASE_URL}/api/player/coachlist`; const res = await fetch(url); if (!res.ok) { @@ -20,7 +21,7 @@ export const getCoachList = async (): Promise => { // player - 투수 리스트 export const getPitcherList = async (): Promise => { - const url = `/api/player/pitcherlist`; + const url = `http://${BASE_URL}/api/player/pitcherlist`; const res = await fetch(url, { method: "GET" }); if (!res.ok) { throw new Error("Failed to fetch coach list"); @@ -35,7 +36,7 @@ export const getCoachDetail = async ( pcode: string ): Promise => { const queryparam = pcode ? `coachdetail?pcode=${pcode}` : ""; - const url = `/api/player/${queryparam}`; + const url = `http://${BASE_URL}/api/player/${queryparam}`; const response = await fetch(url, { method: "GET" }); if (!response.ok) { @@ -51,7 +52,7 @@ export const getPitcherDetail = async ( pcode: string ): Promise => { const queryparam = pcode ? `pitcherdetail?pcode=${pcode}` : ""; - const url = `/api/player/${queryparam}`; + const url = `http://${BASE_URL}/api/player/${queryparam}`; const response = await fetch(url, { method: "GET" }); if (!response.ok) {