From 1e7d3b25c283c556d98c65f1c2f46db4e4178995 Mon Sep 17 00:00:00 2001 From: Jeffrey Schiller Date: Mon, 6 Jun 2022 10:57:19 -0400 Subject: [PATCH] fix: use correct basepath prefix for preview urls (#1971) --- frontend/src/api/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/utils.js b/frontend/src/api/utils.js index ddddcfa7..b995bcb8 100644 --- a/frontend/src/api/utils.js +++ b/frontend/src/api/utils.js @@ -62,7 +62,11 @@ export function removePrefix(url) { } export function createURL(endpoint, params = {}, auth = true) { - const url = new URL(encodePath(endpoint), origin + baseURL); + let prefix = baseURL; + if (prefix[prefix.length] !== "/") { + prefix = prefix + "/"; + } + const url = new URL(prefix + encodePath(endpoint), origin); const searchParams = { ...(auth && { auth: store.state.jwt }),