sws-frontend
Version:
sws frontend project
37 lines (36 loc) • 1.32 kB
TypeScript
export declare const baseopts: {
credentials: RequestCredentials;
'Access-Control-Allow-Origin': string;
};
export declare const writeopts: (body: any) => any;
export declare const baseapi: (basePath: string) => {
get: (url?: string, opts?: {}) => Promise<any>;
post: (url: string, body: any, opts?: any) => Promise<any>;
put: (url: string, body: any, opts?: any) => Promise<any>;
del: (url: string, body?: any, opts?: any) => Promise<any>;
fetch: (url: string, opts?: {}, consumer?: any) => Promise<any>;
writeopts: (body: any) => any;
baseopts: {
credentials: RequestCredentials;
'Access-Control-Allow-Origin': string;
};
createConsumer: (opts: {
defaultName?: string;
contentType?: string;
}) => (r: Response) => void;
};
export default baseapi;
/**
Statuses - https://fetch.spec.whatwg.org/#statuses
A status is a code.
A null body status is a status that is 101, 204, 205, or 304.
An ok status is any status in the range 200 to 299, inclusive.
A redirect status is a status that is 301, 302, 303, 307, or 308
*/
export declare const checkResponse: (r: any, c?: (r: any) => Promise<any>) => any;
export declare const defaultReport: (response: any) => {
title: string;
subtitle: string;
details?: any;
onHide?: any;
};