From 6d4d47b5a10ce787ea77229680c4f11a3b56a7c8 Mon Sep 17 00:00:00 2001 From: Karmanyaah Malhotra <32671690+karmanyaahm@users.noreply.github.com> Date: Tue, 27 Oct 2020 11:03:38 -0400 Subject: [PATCH] Fix getApiUrl() for baseUrl with trailing slash --- src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.js b/src/util.js index 0cd1929..4f85963 100644 --- a/src/util.js +++ b/src/util.js @@ -12,7 +12,7 @@ import { DATE_TIME_FORMAT, EARTH_RADIUS_IN_KM } from "@/constants"; */ export const getApiUrl = (path) => { const normalizedBaseUrl = config.api.baseUrl.endsWith("/") - ? config.api.baseUrl.slice(1) + ? config.api.baseUrl.slice(0, -1) : config.api.baseUrl; const normalizedPath = path.startsWith("/") ? path : `/${path}`; return new URL(`${normalizedBaseUrl}${normalizedPath}`);