UNPKG

react-cookie-auth

Version:

Authentication library with HTTP-only cookies and Page Visibility API for handling sleep/wake cycles

26 lines (25 loc) 868 B
import { LocalStorageKeys } from './types'; /** * Retrieves an item from localStorage and parses it from JSON * * @param key The localStorage key to retrieve * @returns The parsed value, or null if not found or on server */ export declare const getItemFromStorage: <T>(key: LocalStorageKeys) => T | null; /** * Stores an item in localStorage after converting it to JSON * * @param key The localStorage key to store under * @param value The value to store */ export declare const setItemToStorage: <T>(key: LocalStorageKeys, value: T) => void; /** * Removes an item from localStorage * * @param key The localStorage key to remove */ export declare const removeItemFromStorage: (key: LocalStorageKeys) => void; /** * Clears all authentication-related items from localStorage */ export declare const clearAuthStorage: () => void;