Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 | 115x 115x | /**
* Reads a single cookie by name from `document.cookie`. Only useful for
* cookies that are NOT HttpOnly (e.g. the CSRF double-submit cookie) —
* `access_token`/`refresh_token` are HttpOnly and never visible to JS, by
* design — JS must never be able to read them.
*/
export function readCookie(name: string): string | null {
const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`))
return match ? decodeURIComponent(match[1]!) : null
}
|