location_util.ts 393 B

123456789101112
  1. import config from 'app/core/config';
  2. export const stripBaseFromUrl = (url: string): string => {
  3. const appSubUrl = config.appSubUrl;
  4. const stripExtraChars = appSubUrl.endsWith('/') ? 1 : 0;
  5. const urlWithoutBase =
  6. url.length > 0 && url.indexOf(appSubUrl) === 0 ? url.slice(appSubUrl.length - stripExtraChars) : url;
  7. return urlWithoutBase;
  8. };
  9. export default { stripBaseFromUrl };