diff --git a/ui/litellm-dashboard/src/components/create_user_button.tsx b/ui/litellm-dashboard/src/components/create_user_button.tsx index ae8b5f160af..5f7e93deb8d 100644 --- a/ui/litellm-dashboard/src/components/create_user_button.tsx +++ b/ui/litellm-dashboard/src/components/create_user_button.tsx @@ -62,7 +62,7 @@ const Createuser: React.FC = ({ useState(false); const [invitationLinkData, setInvitationLinkData] = useState(null); - const baseUrl = getProxyBaseUrl(); + const [baseUrl, setBaseUrl] = useState(null); // get all models useEffect(() => { const fetchData = async () => { @@ -95,6 +95,8 @@ const Createuser: React.FC = ({ } }; + setBaseUrl(getProxyBaseUrl()); + fetchData(); // Call the function to fetch model data when the component mounts }, []); // Empty dependency array to run only once diff --git a/ui/litellm-dashboard/src/components/onboarding_link.tsx b/ui/litellm-dashboard/src/components/onboarding_link.tsx index 36aa4fc0a41..c7dbc290a67 100644 --- a/ui/litellm-dashboard/src/components/onboarding_link.tsx +++ b/ui/litellm-dashboard/src/components/onboarding_link.tsx @@ -41,10 +41,15 @@ export default function OnboardingModal({ }; const getInvitationUrl = () => { + // Get the path from the base URL + const baseUrlObj = new URL(baseUrl); + const basePath = baseUrlObj.pathname; // This will be "/litellm" or whatever the path is + if (invitationLinkData?.has_user_setup_sso) { - return new URL("/ui", baseUrl).toString(); + return new URL(`${basePath}/ui`, baseUrl).toString(); } - return new URL(`/ui?invitation_id=${invitationLinkData?.id}`, baseUrl).toString(); + const url = new URL(`${basePath}/ui?invitation_id=${invitationLinkData?.id}`, baseUrl).toString(); + return url; }; return (