@shopify/react-network
Version:
A collection of components that allow you to set common HTTP headers from within your React application.
22 lines (21 loc) • 740 B
TypeScript
import { StatusCode, CspDirective } from '@shopify/network';
import { EffectKind } from '@shopify/react-effect';
export { NetworkContext } from './context';
export declare const EFFECT_ID: unique symbol;
export declare class NetworkManager {
readonly effect: EffectKind;
private statusCodes;
private csp;
private redirectUrl?;
reset(): void;
redirectTo(url: string, status?: StatusCode): void;
addStatusCode(statusCode: StatusCode): void;
addCspDirective(directive: CspDirective, value: string | string[] | boolean): void;
extract(): {
status: number | undefined;
csp: {
[key: string]: string | boolean | string[];
};
redirectUrl: string | undefined;
};
}