forked from phoenix/litellm-mirror
fix invite id flow
This commit is contained in:
parent
c3bbc4a692
commit
fdcdee8775
2 changed files with 33 additions and 10 deletions
|
@ -33,7 +33,7 @@ export default function Onboarding() {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const token = getCookie('token');
|
const token = getCookie('token');
|
||||||
const inviteID = searchParams.get("id");
|
const inviteID = searchParams.get("invitation_id");
|
||||||
const [accessToken, setAccessToken] = useState<string | null>(null);
|
const [accessToken, setAccessToken] = useState<string | null>(null);
|
||||||
const [defaultUserEmail, setDefaultUserEmail] = useState<string>("");
|
const [defaultUserEmail, setDefaultUserEmail] = useState<string>("");
|
||||||
const [userEmail, setUserEmail] = useState<string>("");
|
const [userEmail, setUserEmail] = useState<string>("");
|
||||||
|
@ -92,7 +92,10 @@ export default function Onboarding() {
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
let litellm_dashboard_ui = "/ui/";
|
let litellm_dashboard_ui = "/ui/";
|
||||||
const user_id = data.data?.user_id || data.user_id;
|
const user_id = data.data?.user_id || data.user_id;
|
||||||
litellm_dashboard_ui += "?userID=" + user_id + "&token=" + jwtToken;
|
litellm_dashboard_ui += "?userID=" + user_id;
|
||||||
|
|
||||||
|
// set cookie "token" to jwtToken
|
||||||
|
document.cookie = "token=" + jwtToken;
|
||||||
console.log("redirecting to:", litellm_dashboard_ui);
|
console.log("redirecting to:", litellm_dashboard_ui);
|
||||||
|
|
||||||
window.location.href = litellm_dashboard_ui;
|
window.location.href = litellm_dashboard_ui;
|
||||||
|
@ -101,7 +104,7 @@ export default function Onboarding() {
|
||||||
// redirect to login page
|
// redirect to login page
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto max-w-md mt-10">
|
<div className="mx-auto w-full max-w-md mt-10">
|
||||||
<Card>
|
<Card>
|
||||||
<Title className="text-sm mb-5 text-center">🚅 LiteLLM</Title>
|
<Title className="text-sm mb-5 text-center">🚅 LiteLLM</Title>
|
||||||
<Title className="text-xl">Sign up</Title>
|
<Title className="text-xl">Sign up</Title>
|
||||||
|
|
|
@ -77,6 +77,7 @@ const CreateKeyPage = () => {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const [modelData, setModelData] = useState<any>({ data: [] });
|
const [modelData, setModelData] = useState<any>({ data: [] });
|
||||||
const userID = searchParams.get("userID");
|
const userID = searchParams.get("userID");
|
||||||
|
const invitation_id = searchParams.get("invitation_id");
|
||||||
const token = getCookie('token');
|
const token = getCookie('token');
|
||||||
|
|
||||||
const [page, setPage] = useState("api-keys");
|
const [page, setPage] = useState("api-keys");
|
||||||
|
@ -128,7 +129,23 @@ const CreateKeyPage = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
<Suspense fallback={<div>Loading...</div>}>
|
||||||
<div className="flex flex-col min-h-screen">
|
{
|
||||||
|
invitation_id ? (
|
||||||
|
<UserDashboard
|
||||||
|
userID={userID}
|
||||||
|
userRole={userRole}
|
||||||
|
teams={teams}
|
||||||
|
keys={keys}
|
||||||
|
setUserRole={setUserRole}
|
||||||
|
userEmail={userEmail}
|
||||||
|
setUserEmail={setUserEmail}
|
||||||
|
setTeams={setTeams}
|
||||||
|
setKeys={setKeys}
|
||||||
|
setProxySettings={setProxySettings}
|
||||||
|
proxySettings={proxySettings}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="flex flex-col min-h-screen">
|
||||||
<Navbar
|
<Navbar
|
||||||
userID={userID}
|
userID={userID}
|
||||||
userRole={userRole}
|
userRole={userRole}
|
||||||
|
@ -140,11 +157,11 @@ const CreateKeyPage = () => {
|
||||||
/>
|
/>
|
||||||
<div className="flex flex-1 overflow-auto">
|
<div className="flex flex-1 overflow-auto">
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<Sidebar
|
<Sidebar
|
||||||
setPage={setPage}
|
setPage={setPage}
|
||||||
userRole={userRole}
|
userRole={userRole}
|
||||||
defaultSelectedKey={null}
|
defaultSelectedKey={null}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{page == "api-keys" ? (
|
{page == "api-keys" ? (
|
||||||
|
@ -250,7 +267,10 @@ const CreateKeyPage = () => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue