mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(user_dashboard.tsx): initial commit using user id from jwt instead of url
This commit is contained in:
parent
03245c732a
commit
9ff4fa56a7
2 changed files with 12 additions and 2 deletions
|
@ -98,8 +98,8 @@ export default function CreateKeyPage() {
|
||||||
const searchParams = useSearchParams()!;
|
const searchParams = useSearchParams()!;
|
||||||
const [modelData, setModelData] = useState<any>({ data: [] });
|
const [modelData, setModelData] = useState<any>({ data: [] });
|
||||||
const [token, setToken] = useState<string | null>(null);
|
const [token, setToken] = useState<string | null>(null);
|
||||||
|
const [userID, setUserID] = useState<string | null>(null);
|
||||||
|
|
||||||
const userID = searchParams.get("userID");
|
|
||||||
const invitation_id = searchParams.get("invitation_id");
|
const invitation_id = searchParams.get("invitation_id");
|
||||||
|
|
||||||
// Get page from URL, default to 'api-keys' if not present
|
// Get page from URL, default to 'api-keys' if not present
|
||||||
|
@ -177,6 +177,10 @@ export default function CreateKeyPage() {
|
||||||
if (decoded.auth_header_name) {
|
if (decoded.auth_header_name) {
|
||||||
setGlobalLitellmHeaderName(decoded.auth_header_name);
|
setGlobalLitellmHeaderName(decoded.auth_header_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decoded.user_id) {
|
||||||
|
setUserID(decoded.user_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,13 @@ const UserDashboard: React.FC<UserDashboardProps> = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userID == null || token == null) {
|
if (userID == null) {
|
||||||
|
return (
|
||||||
|
<h1>User ID is not set</h1>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
// user is not logged in as yet
|
// user is not logged in as yet
|
||||||
console.log("All cookies before redirect:", document.cookie);
|
console.log("All cookies before redirect:", document.cookie);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue