23 lines
694 B
TypeScript
23 lines
694 B
TypeScript
export function shouldUseSSO() {
|
|
const appEnv = import.meta.env.VITE_APP_ENVIRONMENT || "local";
|
|
return appEnv.startsWith("prod") || appEnv.startsWith("stage");
|
|
}
|
|
|
|
function constructURL(basePath: string, params = {}) {
|
|
const queryParams = new URLSearchParams(params);
|
|
return `${basePath}${queryParams.toString() ? `?${queryParams}` : ""}`;
|
|
}
|
|
|
|
export function getLoginURL(params = {}) {
|
|
const basePath = shouldUseSSO() ? "/sso/login" : "/login-local";
|
|
return constructURL(basePath, params);
|
|
}
|
|
|
|
export function getSignUpURL(params = {}) {
|
|
return constructURL("/sso/signup", params);
|
|
}
|
|
|
|
export function getLoginURLNext() {
|
|
return getLoginURL({ next: window.location.pathname });
|
|
}
|