aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/frontend/src/main/components/utils
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/frontend/src/main/components/utils')
-rw-r--r--plugins/base/frontend/src/main/components/utils/requests.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/base/frontend/src/main/components/utils/requests.tsx b/plugins/base/frontend/src/main/components/utils/requests.tsx
new file mode 100644
index 00000000..4a14e6f6
--- /dev/null
+++ b/plugins/base/frontend/src/main/components/utils/requests.tsx
@@ -0,0 +1,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}`
+} \ No newline at end of file