datasquirel/dist/client/fetch/index.d.ts
2025-12-26 12:08:45 +01:00

30 lines
752 B
TypeScript

import { DSQLClientFetchHeader } from "../../package-shared/types";
type FetchApiOptions<T extends {
[k: string]: any;
} = {
[k: string]: any;
}> = {
method: "POST" | "GET" | "DELETE" | "PUT" | "PATCH" | "post" | "get" | "delete" | "put" | "patch";
body?: T | string;
headers?: DSQLClientFetchHeader;
};
export type FetchApiReturn = {
success: boolean;
payload: any;
msg?: string;
[key: string]: any;
};
/**
* # Fetch API
*/
export default function fetchApi<T extends {
[k: string]: any;
} = {
[k: string]: any;
}, R extends any = any>(url: string, options?: FetchApiOptions<T>, csrf?: boolean,
/**
* Key to use to grab local Storage csrf value.
*/
localStorageCSRFKey?: string): Promise<R>;
export {};