mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
more window guards
This commit is contained in:
parent
cee408c0c0
commit
00f61b214c
2 changed files with 16 additions and 11 deletions
|
|
@ -105,18 +105,19 @@ const VirtualKeysTable = ({
|
|||
|
||||
// Add a useEffect to call refresh when a key is created
|
||||
useEffect(() => {
|
||||
if (refresh) {
|
||||
const handleStorageChange = () => {
|
||||
refresh();
|
||||
};
|
||||
|
||||
// Listen for storage events that might indicate a key was created
|
||||
window.addEventListener("storage", handleStorageChange);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("storage", handleStorageChange);
|
||||
};
|
||||
if (!refresh || typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
const handleStorageChange = () => {
|
||||
refresh();
|
||||
};
|
||||
|
||||
// Listen for storage events that might indicate a key was created
|
||||
window.addEventListener("storage", handleStorageChange);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("storage", handleStorageChange);
|
||||
};
|
||||
}, [refresh]);
|
||||
|
||||
const columns: ColumnDef<KeyResponse>[] = [
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
* Clears the token cookie from both root and /ui paths
|
||||
*/
|
||||
export function clearTokenCookies() {
|
||||
if (typeof window === "undefined" || typeof document === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current domain
|
||||
const domain = window.location.hostname;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue