mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(page.tsx): fix invitation link flow
This commit is contained in:
parent
3df2d75c53
commit
ed756532a1
1 changed files with 4 additions and 2 deletions
|
@ -139,6 +139,8 @@ export default function CreateKeyPage() {
|
||||||
|
|
||||||
const [accessToken, setAccessToken] = useState<string | null>(null);
|
const [accessToken, setAccessToken] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const redirectToLogin = authLoading === false && token === null && invitation_id === null;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const token = getCookie("token");
|
const token = getCookie("token");
|
||||||
setToken(token);
|
setToken(token);
|
||||||
|
@ -146,7 +148,7 @@ export default function CreateKeyPage() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (authLoading === false && token === null) {
|
if (redirectToLogin) {
|
||||||
window.location.href = (proxyBaseUrl || "") + "/sso/key/generate"
|
window.location.href = (proxyBaseUrl || "") + "/sso/key/generate"
|
||||||
}
|
}
|
||||||
}, [token, authLoading])
|
}, [token, authLoading])
|
||||||
|
@ -221,7 +223,7 @@ export default function CreateKeyPage() {
|
||||||
}
|
}
|
||||||
}, [accessToken, userID, userRole]);
|
}, [accessToken, userID, userRole]);
|
||||||
|
|
||||||
if (authLoading || (authLoading == false && token === null)) {
|
if (authLoading) {
|
||||||
return <LoadingScreen />
|
return <LoadingScreen />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue