UNPKG

@churchapps/helpers

Version:

Library of helper functions not specific to any one ChurchApps project or framework.

29 lines 1.4 kB
import { ApiConfig, RolePermissionInterface, ApiListType } from "./interfaces/index.js"; declare global { interface Window { __CHURCHAPPS_API_HELPER__?: ApiHelperClass; } var __CHURCHAPPS_API_HELPER__: ApiHelperClass | undefined; } declare class ApiHelperClass { apiConfigs: ApiConfig[]; isAuthenticated: boolean; onRequest: (url: string, requestOptions: any) => void; onError: (url: string, requestOptions: any, error: any) => void; getConfig(keyName: string): ApiConfig; setDefaultPermissions(jwt: string): void; setPermissions(keyName: string, jwt: string, permissions: RolePermissionInterface[]): void; clearPermissions(): void; get(path: string, apiName: ApiListType): Promise<any>; getAnonymous(path: string, apiName: ApiListType): Promise<any>; post(path: string, data: any[] | {}, apiName: ApiListType): Promise<any>; patch(path: string, data: any[] | {}, apiName: ApiListType): Promise<any>; delete(path: string, apiName: ApiListType): Promise<void>; deleteAnonymous(path: string, apiName: ApiListType): Promise<void>; postAnonymous(path: string, data: any[] | {}, apiName: ApiListType): Promise<any>; fetchWithErrorHandling(url: string, requestOptions: any): Promise<any>; private throwApiError; } export declare const ApiHelper: any; export type { ApiHelperClass }; //# sourceMappingURL=ApiHelper.d.ts.map