import { whenLoggedIn } from '../../components/hoc/whenLoggedIn';
import { Router, withRouter } from '../../components/hoc/withRouter';
import { translate } from '../../helpers/l10n';
+import { getBaseUrl } from '../../helpers/system';
import { hasGlobalPermission } from '../../helpers/users';
import { Permissions } from '../../types/permissions';
import { RiskConsent } from '../../types/plugins';
value: RiskConsent.Accepted
});
- window.location.href = `/`; // force a refresh for the backend
+ // force a refresh for the backend
+ window.location.href = `${getBaseUrl()}/`;
} catch (_) {
/* Do nothing */
}
user={currentUser}
onPasswordChange={() => {
// Force a refresh for the backend to handle additional redirects.
- window.location.href = getBaseUrl() + '/';
+ window.location.href = `${getBaseUrl()}/`;
}}
/>
</div>
handleLogin = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
event.preventDefault();
const returnTo = encodeURIComponent(window.location.pathname + window.location.search);
- window.location.href =
- getBaseUrl() + `/sessions/new?return_to=${returnTo}${window.location.hash}`;
+ window.location.href = `${getBaseUrl()}/sessions/new?return_to=${returnTo}${
+ window.location.hash
+ }`;
};
handleLogout = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { getBaseUrl } from '../../helpers/system';
+
export default function handleRequiredAuthorization() {
const returnTo = window.location.pathname + window.location.search + window.location.hash;
const searchParams = new URLSearchParams({ return_to: returnTo, authorizationError: 'true' });
- window.location.replace(`/sessions/new?${searchParams.toString()}`);
+ window.location.replace(`${getBaseUrl()}/sessions/new?${searchParams.toString()}`);
}
import webAPIRoutes from '../../apps/web-api/routes';
import webhooksRoutes from '../../apps/webhooks/routes';
import { omitNil } from '../../helpers/request';
+import { getBaseUrl } from '../../helpers/system';
import { AppState } from '../../types/appstate';
import { CurrentUser } from '../../types/users';
import AdminContainer from '../components/AdminContainer';
<CurrentUserContextProvider currentUser={currentUser}>
<IntlProvider defaultLocale={lang} locale={lang}>
<GlobalMessagesContainer />
- <BrowserRouter>
+ <BrowserRouter basename={getBaseUrl()}>
<Routes>
{renderRedirects()}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { getBaseUrl } from './system';
+
export default function handleRequiredAuthentication() {
const returnTo = window.location.pathname + window.location.search + window.location.hash;
const searchParams = new URLSearchParams({ return_to: returnTo });
- window.location.replace(`/sessions/new?${searchParams.toString()}`);
+ window.location.replace(`${getBaseUrl()}/sessions/new?${searchParams.toString()}`);
}
if (isRelativeUrl(returnTo)) {
return returnTo + (location.hash ? location.hash : '');
}
- return getBaseUrl() + '/';
+ return `${getBaseUrl()}/`;
}
export function isRelativeUrl(url?: string): boolean {