aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/frontend/src/main/components/utils/requests.tsx
blob: c95dda6979ae73d3aaac6ef780e7c03d333ae8bb (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}`
}