2021-08-01 19:24:47 -08:00
|
|
|
import { AxiosResponse } from "axios";
|
|
|
|
|
2022-01-09 07:15:23 +01:00
|
|
|
export interface RequestResponse<T> {
|
2021-08-06 16:28:12 -08:00
|
|
|
response: AxiosResponse<T> | null;
|
|
|
|
data: T | null;
|
|
|
|
error: any;
|
|
|
|
}
|
2021-08-01 19:24:47 -08:00
|
|
|
|
|
|
|
export interface ApiRequestInstance {
|
2022-01-09 07:15:23 +01:00
|
|
|
get<T>(url: string, data?: unknown): Promise<RequestResponse<T>>;
|
|
|
|
post<T>(url: string, data: unknown): Promise<RequestResponse<T>>;
|
|
|
|
put<T, U = T>(url: string, data: U): Promise<RequestResponse<T>>;
|
|
|
|
patch<T, U = Partial<T>>(url: string, data: U): Promise<RequestResponse<T>>;
|
|
|
|
delete<T>(url: string): Promise<RequestResponse<T>>;
|
2021-08-01 19:24:47 -08:00
|
|
|
}
|
2022-06-25 14:39:38 -05:00
|
|
|
|
|
|
|
export interface PaginationData<T> {
|
|
|
|
page: number;
|
|
|
|
per_page: number;
|
|
|
|
total: number;
|
|
|
|
total_pages: number;
|
|
|
|
items: T[];
|
|
|
|
}
|