Services
Located in react-wrench/lib/services/<service>
.
List:
Fetch
Utilities for the global fetch
function.
Handlers
Import:
import * as handlers from "react-wrench/lib/services/fetch/handlers";
Types:
export declare function handleError(res: Response): Promise<Response>;
export declare function handleJSON<T>(res: Response): Promise<T>;
Headers
Import:
import * as headers from "react-wrench/lib/services/fetch/headers";
Types:
export declare const JSON_GET: {
Accept: string;
};
export declare const JSON_SEND: {
"Content-Type": string;
};
export declare const JSON_BOTH: {
"Content-Type": string;
Accept: string;
};
Geo
Import:
import * as geo from "react-wrench/lib/services/geo";
Types:
declare type Geo = {
lon: number;
lat: number;
};
export declare const getCurrent: () => Promise<Geo | null>;
export declare const useGeo: () => Geo | null;
export {};
Relay
Import:
import * as relay from "react-wrench/lib/services/relay";
Types:
export declare const commitMutation: <R extends MutationParameters>(environment: Environment, config: Pick<MutationConfig<R>, "optimisticUpdater" | "optimisticResponse" | "updater" | "uploadables" | "variables" | "configs" | "mutation">) => Promise<R["response"]>;
Utilities for working with Relay.
Session
Utilities for handling session data.
Cookies
Import:
import * as cookies from "react-wrench/lib/services/session/cookies";
Types:
declare type Options = {
expires?: number | Date;
domain?: string;
path?: string;
secure?: boolean;
};
export declare const load: (key: string) => string | null;
export declare const save: (key: string, value: string, opts?: Options | undefined) => void;
export declare const remove: (key: string, opts?: Options | undefined) => void;
export {};
Local
Import:
import * as local from "react-wrench/lib/services/session/local";
Types:
export declare const load: (key: string) => string | null;
export declare const save: (key: string, value: string) => void;
export declare const remove: (key: string) => void;
Session
Import:
import * as session from "react-wrench/lib/services/session/session";
Types:
export declare const load: (key: string) => string | null;
export declare const save: (key: string, value: string) => void;
export declare const remove: (key: string) => void;