Closed nakyoung98 closed 1 month ago
Closes: #10
[๋ชฉํ]
const apiCall = <RequestDTO, ResponseDTO>({ method, endpoint, data, headers, params, option, }: { method: HTTP_METHOD; endpoint: ENDPOINT; data?: RequestDTO; headers?: AxiosHeaders; params?: URLSearchParams; option?: OPTIONS<RequestDTO>; }): Promise<AxiosResponse<ResponseDTO>> => axiosInstance.request<ResponseDTO, AxiosResponse<ResponseDTO>, RequestDTO>({ method, url: endpoint, data, headers, params, ...option, });
export const tokenRequestInterceptor = (config: InternalAxiosRequestConfig) => { const accessToken = localStorage.getItem("accessToken"); if (accessToken) { config.headers.Authorization = `Bearer ${accessToken}`; } return config; };
export class UnauthorizedError extends AxiosError { constructor(error: AxiosError) { super(error.message, error.code, error.config, error.request, error.response); this.name = "UnauthorizedError"; this.message = "Please log in to access this resource"; } }
export const API_URLS: API_URL_TYPE = { HERO: {}, SIGN_IN: { SIGN_IN: `${API_BASE_URL}/user/sign-in`, }, // ... } as const;
๊ฐ๋ฐ ๊ธฐ๋ก
rebase์ ๋ํ PR ์ปจ๋ฒค์ ์ ์ ์ค์ํ์ จ๊ตฐ์! ์ฝ๋ ์์ฑํ์๋๋ผ ์๊ณ ๋ง์ผ์ จ์ต๋๋ค :)
๐ ๊ด๋ จ ์ด์
Closes: #10
โจ ์์ ๋ด์ฉ
1. API ํธ์ถ ๊ธฐ๋ณธ ๊ตฌ์กฐ ๊ตฌํ
[๋ชฉํ]
2. ํ ํฐ ์ธํฐ์ ํฐ ๊ตฌํ
[๋ชฉํ]
3. ์๋ฌ ์ฒ๋ฆฌ
[๋ชฉํ]
4. API URL ์์ ์ ์
[๋ชฉํ]
โ ๏ธ ์ฃผ์ ์ฌํญ
๐ธ ์คํฌ๋ฆฐ์ท
๐ ์ฐธ๊ณ ์๋ฃ
๊ฐ๋ฐ ๊ธฐ๋ก
๐ ๋ฌธ์ํ ๊ณํ
โ ์ถ๊ฐ ์์ ์ฌํญ
โ๏ธ ์ฒดํฌ๋ฆฌ์คํธ