location_util.ts 391 B

1234567891011121314
  1. import config from 'app/core/config';
  2. const _stripBaseFromUrl = url => {
  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 {
  10. stripBaseFromUrl: _stripBaseFromUrl,
  11. };