From 5d3a761158903bfbca761195dbef6eda4f8946e3 Mon Sep 17 00:00:00 2001 From: 6mn12j Date: Thu, 28 Mar 2024 22:52:28 +0900 Subject: [PATCH] =?UTF-8?q?Feature:=20token=20api=20=ED=83=80=EC=9E=85,=20?= =?UTF-8?q?url=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/oauth/index.ts | 7 +++++-- src/types/api-response.d.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/oauth/index.ts b/src/api/oauth/index.ts index 18f3f41..c4a25ce 100644 --- a/src/api/oauth/index.ts +++ b/src/api/oauth/index.ts @@ -1,5 +1,8 @@ -export const postOauthToken = async (code: string): Promise => { - const response = await fetch('/api/oauth/token', { +import ApiResponse from '@/types/api-response'; + +export const postOauthToken = async (code: string | null): Promise => { + const baseUrl = typeof window === 'undefined' ? process.env.NEXT_PUBLIC_BASE_URL : 'api'; + const response = await fetch(`${baseUrl}/oauth/token`, { method: 'POST', body: JSON.stringify({ code }), headers: { diff --git a/src/types/api-response.d.ts b/src/types/api-response.d.ts index 90a113d..499d6f3 100644 --- a/src/types/api-response.d.ts +++ b/src/types/api-response.d.ts @@ -9,7 +9,7 @@ declare namespace ApiResponse { result: string; } - interface ResponseAuthTokenData { + interface ResponseAuthTokenData extends ResponseResult { data: User; } }