mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
Update ui/litellm-dashboard/src/utils/cookieUtils.ts
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
parent
04f835ecfa
commit
22409da932
1 changed files with 8 additions and 1 deletions
|
|
@ -64,5 +64,12 @@ export function setTokenCookie(token: string) {
|
|||
export function getCookie(name: string) {
|
||||
if (typeof document === "undefined") return null;
|
||||
const cookieValue = document.cookie.split("; ").find((row) => row.startsWith(name + "="));
|
||||
return cookieValue ? (() => { try { return decodeURIComponent(cookieValue.split("=")[1]); } catch { return cookieValue.split("=")[1]; } })() : null;
|
||||
if (!cookieValue) return null;
|
||||
const rawValue = cookieValue.split("=")[1];
|
||||
try {
|
||||
return decodeURIComponent(rawValue);
|
||||
} catch {
|
||||
return rawValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue