@trimble-oss/trimble-id-react
Version:
> **Important Notice:** > > As of version 1.0.0, `PersistentOptions` have been removed. By default, the SDK now supports in-memory token storage. > > When you upgrade to version 1.x, storage options will no longer be available, resulting in a breaking
43 lines (42 loc) • 1.61 kB
TypeScript
interface CookiesOptions {
/**
* Number of days until the cookies expire
* @type {number}
*/
expires?: number;
/**
* Domain name to registry the cookies for. By default, is the name of the site
* @type {string}
*/
domain?: string;
}
/** Class to store cookies in the browser */
export declare class CookiesStorage {
/**
* Retrieve a cookie from the browser
* @param {string} key - Key to retrieve the cookies
*/
get(key: string): any;
/**
* Store cookies in the browser
* @param {string} key - Key to save and retrieve the cookies
* @param {any} value - Information you want to store in cookies
* @param {CookiesOptions} options - Additional options you want to add to the cookies.
* @example Save cookies with one day of expiration
* cookiesStorage.set('key',{data:{...}},{expires:1})
* @example Save cookies with a custom domain
* cookiesStorage.set('key',{data:{...}},{domain:'https://example.com/subpath'})
*/
set(key: string, value: any, options: CookiesOptions): void;
/**
* Remove a cookie from the browser
* @param {string} key - Key to remove the cookies from the browser
* @param {CookiesOptions} options - Additional options used when the cookie was declared
* @example Remove cookies without additional information
* cookiesStorage.remove('key')
* @example Remove cookies with custom domain
* cookiesStorage.remove('key',{domain:'https://example.com/subpath'})
*/
remove(key: string, options?: CookiesOptions): void;
}
export {};