Skip to content

Commit

Permalink
refactor: apiClient 타입 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
chlwlstlf committed Jan 17, 2025
1 parent 7880270 commit 22f05b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
17 changes: 17 additions & 0 deletions frontend/src/@types/apiClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";

export interface ApiProps {
endpoint: string;
headers?: Record<string, string>;
body?: object | null;
errorMessage?: string;
}

export interface RequestProps extends ApiProps {
method: Method;
}

export interface QueueItem {
resolve: (value: string | PromiseLike<string>) => void;
reject: (reason?: Error) => void;
}
19 changes: 1 addition & 18 deletions frontend/src/apis/apiClient.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
import { API_ENDPOINTS } from "./endpoints";
import { ApiProps, Method, QueueItem, RequestProps } from "@/@types/apiClient";
import { serverUrl } from "@/config/serverUrl";
import MESSAGES from "@/constants/message";
import { AuthorizationError, HTTPError } from "@/utils/Errors";

type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";

interface ApiProps {
endpoint: string;
headers?: Record<string, string>;
body?: object | null;
errorMessage?: string;
}

interface RequestProps extends ApiProps {
method: Method;
}

interface QueueItem {
resolve: (value: string | PromiseLike<string>) => void;
reject: (reason?: Error) => void;
}

let isRefreshing = false;
let failedQueue: QueueItem[] = [];

Expand Down

0 comments on commit 22f05b8

Please sign in to comment.