export function shouldUseSSO() {
  const appEnv = import.meta.env.VITE_APP_ENVIRONMENT || "local";
  return appEnv.startsWith("prod") || appEnv.startsWith("stage");
}

export function getLoginURL(params = {}) {
  let url = shouldUseSSO() ? "/sso/login/" : "/login-local";

  const queryParams = new URLSearchParams(params);
  if (queryParams.toString()) {
    url += `?${queryParams}`;
  }

  return url;
}

export function getLoginURLNext() {
  return getLoginURL({ next: window.location.pathname });
}
