beautiful-react-hooks
Version:
A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development
29 lines (28 loc) • 832 B
TypeScript
export declare enum ECookieSameSite {
STRICT = "strict",
LAX = "lax",
NONE = "none"
}
interface ICookieStoreDeleteOptions {
name?: string;
domain?: string;
path?: string;
}
interface ICookieInit extends ICookieStoreDeleteOptions {
sameSite?: ECookieSameSite;
}
export interface IOptions extends ICookieInit {
defaultValue?: string;
}
declare const useCookie: (key: string, options?: IOptions) => Readonly<{
onError: import("./shared/types").Noop;
updateCookie: import("./shared/types").Noop;
deleteCookie: import("./shared/types").Noop;
cookieValue: string;
}> | Readonly<{
cookieValue: string;
updateCookie: (newValue: string) => Promise<void>;
deleteCookie: () => Promise<void>;
onError: import("./shared/types").CallbackSetter<Error>;
}>;
export default useCookie;