We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b21c75 commit 0548dfcCopy full SHA for 0548dfc
src/apis/instance.request.ts
@@ -13,13 +13,16 @@ if (!BASE_URL) {
13
throw new Error('BASE_URL이 ENV에서 설정되지 않았습니다.');
14
}
15
16
-type ErrorObject = Record<string, Error>;
+type ErrorType = {
17
+ code: string;
18
+ statusCode: number;
19
+};
20
21
type SuccessType<T> = {
22
success: true;
23
message: string;
24
data: T;
- error: null;
25
+ error: null | ErrorType;
26
};
27
28
export type InitType<I> = Omit<NonNullable<FetchArgs[1]>, 'body'> & {
@@ -54,7 +57,7 @@ const fetch = returnFetch({
54
57
export const instance = async <I, R>(
55
58
input: URL | RequestInfo,
56
59
init?: InitType<I>,
- error?: ErrorObject,
60
+ error?: Record<string, Error>,
61
): Promise<R> => {
62
try {
63
const data = await fetch('/api' + input, {
0 commit comments