2021-08-02 03:24:47 +00:00
|
|
|
import { AxiosResponse } from "axios";
|
|
|
|
|
|
|
|
interface RequestResponse<T> {
|
2021-08-07 00:28:12 +00:00
|
|
|
response: AxiosResponse<T> | null;
|
|
|
|
data: T | null;
|
|
|
|
error: any;
|
|
|
|
}
|
2021-08-02 03:24:47 +00:00
|
|
|
|
|
|
|
export interface ApiRequestInstance {
|
2021-08-07 00:28:12 +00:00
|
|
|
get<T>(url: string, data?: T | object): Promise<RequestResponse<T>>;
|
|
|
|
post<T>(url: string, data: T | object | any): Promise<RequestResponse<T>>;
|
|
|
|
put<T>(url: string, data: T | object): Promise<RequestResponse<T>>;
|
|
|
|
patch<T>(url: string, data: T | object): Promise<RequestResponse<T>>;
|
|
|
|
delete<T>(url: string, data?: T | object): Promise<RequestResponse<T>>;
|
2021-08-02 03:24:47 +00:00
|
|
|
}
|