type Params = { key: string; } export const getCookie = ({ key }: Params): string | null => { const item = document.cookie.match("(^|;)\\s*" + key + "\\s*=\\s*([^;]+)"); return item?.pop() || null; };