Skip to content

Commit 258853b

Browse files
committed
Update request.ts
1 parent 4612f92 commit 258853b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/structures/request.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import axios, { AxiosRequestConfig, Method } from 'axios';
2+
import { ReqRet } from '../types';
3+
import st from './http_status';
24

35
export default async <T>(
46
url: string,
57
token: string,
68
method: Method,
79
options: AxiosRequestConfig
8-
): Promise<T> => {
10+
): Promise<ReqRet<T>> => {
911
return await axios
1012
.request<T>({
1113
url,
@@ -18,7 +20,10 @@ export default async <T>(
1820
...options,
1921
})
2022
.then((response) => {
21-
return Promise.resolve(response.data);
23+
return Promise.resolve({
24+
data: response.data,
25+
status: st(response.status),
26+
});
2227
})
2328
.catch((error) => {
2429
return Promise.reject(error);

0 commit comments

Comments
 (0)