forked from TWS/kalkutago
8 lines
322 B
TypeScript
8 lines
322 B
TypeScript
export function getCookie(key: string): string | null {
|
|
const start = document.cookie.indexOf(key + '=')
|
|
if(start === -1) return null
|
|
let end: number | undefined = document.cookie.indexOf(';', start)
|
|
if(end === -1)
|
|
end = undefined
|
|
return document.cookie.substring(start + key.length + 1, end)
|
|
} |