aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/frontend/src/main/components/utils/requests.tsx
blob: 4a14e6f68c88719ceb47f2ea3b3683dc627d01e1 (plain)
1
2
3
4
5
6
7
import { IWindow } from "../search/types"

export const relativizeUrlForRequest = (filePath: string) : string => {
    const pathToRoot = (window as IWindow).pathToRoot
    const relativePath = pathToRoot == "" ? "." : pathToRoot
    return relativePath.endsWith('/') ? `${relativePath}${filePath}` : `${relativePath}/${filePath}`
}