mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 00:08:10 -05:00
15 lines
391 B
TypeScript
15 lines
391 B
TypeScript
import config from 'app/core/config';
|
|
|
|
const _stripBaseFromUrl = url => {
|
|
const appSubUrl = config.appSubUrl;
|
|
const stripExtraChars = appSubUrl.endsWith('/') ? 1 : 0;
|
|
const urlWithoutBase =
|
|
url.length > 0 && url.indexOf(appSubUrl) === 0 ? url.slice(appSubUrl.length - stripExtraChars) : url;
|
|
|
|
return urlWithoutBase;
|
|
};
|
|
|
|
export default {
|
|
stripBaseFromUrl: _stripBaseFromUrl,
|
|
};
|