mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
refactor(ui): guard buildOnboardingUrl against a missing invitation id
Return "" instead of emitting an invitation_id=undefined link when the id is not yet available, matching the existing empty-baseUrl guard. Placed after the SSO branch so the SSO link, which does not use the id, is unaffected Refs LIT-3687
This commit is contained in:
parent
c7a5e211c8
commit
82ca9a2a60
2 changed files with 14 additions and 0 deletions
|
|
@ -56,4 +56,15 @@ describe("buildOnboardingUrl", () => {
|
|||
}),
|
||||
).toBe("");
|
||||
});
|
||||
|
||||
it("returns an empty string rather than an invitation_id=undefined link when the id is not ready", () => {
|
||||
expect(
|
||||
buildOnboardingUrl({
|
||||
baseUrl: "http://localhost:4000/",
|
||||
invitationId: undefined,
|
||||
hasUserSetupSso: false,
|
||||
resetPassword: false,
|
||||
}),
|
||||
).toBe("");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ export function buildOnboardingUrl({
|
|||
if (hasUserSetupSso) {
|
||||
return new URL(uiPath, baseUrl).toString();
|
||||
}
|
||||
if (!invitationId) {
|
||||
return "";
|
||||
}
|
||||
const action = resetPassword ? "&action=reset_password" : "";
|
||||
return new URL(`${uiPath}/onboarding?invitation_id=${invitationId}${action}`, baseUrl).toString();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue