Skip to content

Commit

Permalink
Feature: token api 타입, url 정의
Browse files Browse the repository at this point in the history
  • Loading branch information
6mn12j committed Mar 28, 2024
1 parent 0268ab4 commit 5d3a761
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/api/oauth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export const postOauthToken = async <T>(code: string): Promise<T> => {
const response = await fetch('/api/oauth/token', {
import ApiResponse from '@/types/api-response';

export const postOauthToken = async (code: string | null): Promise<ApiResponse.ResponseAuthTokenData> => {
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: {
Expand Down
2 changes: 1 addition & 1 deletion src/types/api-response.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare namespace ApiResponse {
result: string;
}

interface ResponseAuthTokenData {
interface ResponseAuthTokenData extends ResponseResult {
data: User;
}
}
Expand Down

0 comments on commit 5d3a761

Please sign in to comment.