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:
Hendrik Jaks 2026-03-13 10:15:21 +02:00 • committed by GitHub
parent 2c5caac531
commit 04f835ecfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,5 +64,5 @@ 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 ? decodeURIComponent(cookieValue.split("=")[1]) : null;
return cookieValue ? (() => { try { return decodeURIComponent(cookieValue.split("=")[1]); } catch { return cookieValue.split("=")[1]; } })() : null;
}