Files
directus/app/src/utils/get-root-path.ts
2021-01-19 12:11:16 -05:00

16 lines
466 B
TypeScript

export function getRootPath(): string {
const path = window.location.pathname;
const parts = path.split('/');
const adminIndex = parts.indexOf('admin');
const rootPath = parts.slice(0, adminIndex).join('/') + '/';
return rootPath;
}
export function getPublicURL() {
const path = window.location.href;
const parts = path.split('/');
const adminIndex = parts.indexOf('admin');
const rootPath = parts.slice(0, adminIndex).join('/') + '/';
return rootPath;
}