api response
This commit is contained in:
1 parent
7121b2f4cd
commit
12f00eb639
1 file changed
+14
@@ -1,6 +1,20 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import type { AxiosInstance } from 'axios';
|
import type { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
type ApiResponse = [string | null, any | null];
|
||||||
|
|
||||||
|
declare module 'axios' {
|
||||||
|
export interface AxiosInstance {
|
||||||
|
request(config: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
get(url: string, config?: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
delete(url: string, config?: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
head(url: string, config?: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
post(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
put(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
patch(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: 'http://localhost:41337',
|
baseURL: 'http://localhost:41337',
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
|
|||||||
Reference in new issue
Block a user