forked from phoenix/litellm-mirror
ui - read jwts from cookie
This commit is contained in:
parent
709bd9678c
commit
204f7725ee
1 changed files with 10 additions and 1 deletions
|
@ -24,6 +24,14 @@ type UserSpendData = {
|
||||||
max_budget?: number | null;
|
max_budget?: number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getCookie(name: string) {
|
||||||
|
console.log("COOKIES", document.cookie)
|
||||||
|
const cookieValue = document.cookie
|
||||||
|
.split('; ')
|
||||||
|
.find(row => row.startsWith(name + '='));
|
||||||
|
return cookieValue ? cookieValue.split('=')[1] : null;
|
||||||
|
}
|
||||||
|
|
||||||
interface UserDashboardProps {
|
interface UserDashboardProps {
|
||||||
userID: string | null;
|
userID: string | null;
|
||||||
userRole: string | null;
|
userRole: string | null;
|
||||||
|
@ -66,7 +74,8 @@ const UserDashboard: React.FC<UserDashboardProps> = ({
|
||||||
const viewSpend = searchParams.get("viewSpend");
|
const viewSpend = searchParams.get("viewSpend");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const token = searchParams.get("token");
|
const token = getCookie('token');
|
||||||
|
|
||||||
const [accessToken, setAccessToken] = useState<string | null>(null);
|
const [accessToken, setAccessToken] = useState<string | null>(null);
|
||||||
const [teamSpend, setTeamSpend] = useState<number | null>(null);
|
const [teamSpend, setTeamSpend] = useState<number | null>(null);
|
||||||
const [userModels, setUserModels] = useState<string[]>([]);
|
const [userModels, setUserModels] = useState<string[]>([]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue