Skip to content

Commit c06ca48

Browse files
committed
fix: 타입 중복 제거
1 parent 9d382ff commit c06ca48

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

frontend/src/lib/axios.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
22

3-
export interface CommonResponse<T> {
4-
code: "SUCCESS" | "ERROR" | "FAIL";
5-
data: T;
6-
message: string;
7-
statusCode: number;
8-
}
9-
// TODO: URL 수정
10-
const axiosInstance = axios.create({
11-
baseURL: process.env.API_URL,
12-
});
13-
14-
export const Get = async <T>(
153
url: string,
164
config?: AxiosRequestConfig,
17-
): Promise<AxiosResponse<CommonResponse<T>>> => {
5+
): Promise<AxiosResponse<T>> => {
186
const response = await axiosInstance.get(url, config);
197
return response;
208
};
@@ -23,15 +11,15 @@ export const Post = async <T, D>(
2311
url: string,
2412
data?: D,
2513
config?: AxiosRequestConfig,
26-
): Promise<AxiosResponse<CommonResponse<T>>> => {
14+
): Promise<AxiosResponse<T>> => {
2715
const response = await axiosInstance.post(url, data, config);
2816
return response;
2917
};
3018

3119
export const Delete = async <T>(
3220
url: string,
3321
config?: AxiosRequestConfig,
34-
): Promise<AxiosResponse<CommonResponse<T>>> => {
22+
): Promise<AxiosResponse<T>> => {
3523
const response = await axiosInstance.delete(url, config);
3624
return response;
3725
};
@@ -40,16 +28,16 @@ export const Patch = async <T, D>(
4028
url: string,
4129
data?: D,
4230
config?: AxiosRequestConfig,
43-
): Promise<AxiosResponse<CommonResponse<T>>> => {
44-
const response = await axiosInstance.post(url, data, config);
31+
): Promise<AxiosResponse<T>> => {
32+
const response = await axiosInstance.patch(url, data, config);
4533
return response;
4634
};
4735

4836
export const Put = async <T, D>(
4937
url: string,
5038
data?: D,
5139
config?: AxiosRequestConfig,
52-
): Promise<AxiosResponse<CommonResponse<T>>> => {
40+
): Promise<AxiosResponse<T>> => {
5341
const response = await axiosInstance.put(url, data, config);
5442
return response;
5543
};

0 commit comments

Comments
 (0)