From 98b17e5b22fee8e83bfe5a21b79fac297bf1eaf0 Mon Sep 17 00:00:00 2001 From: mrfry Date: Mon, 15 Feb 2021 10:06:29 +0100 Subject: [PATCH] url query formatting fix, removed trailing ? --- src/utils/utils.ts | 19 ++++++++++--------- submodules/qmining-page | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index ee8ec15..b192b63 100755 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -22,16 +22,17 @@ interface URLFormatOptions { } function formatUrl(options: URLFormatOptions): string { - console.log(options.pathname, options.query) - const queryString = options.query - ? '?' + - Object.keys(options.query) - .map((key) => { - return `${key}=${encodeURIComponent(options.query[key])}` - }) - .join('&') - : '' const path = options.pathname || '' + if (!options.query || Object.keys(options.query).length === 0) { + return path + } + const queryString = + '?' + + Object.keys(options.query) + .map((key) => { + return `${key}=${encodeURIComponent(options.query[key])}` + }) + .join('&') return path + queryString } diff --git a/submodules/qmining-page b/submodules/qmining-page index e224260..230f069 160000 --- a/submodules/qmining-page +++ b/submodules/qmining-page @@ -1 +1 @@ -Subproject commit e224260a00437bca1338641b4da4dc5cca627016 +Subproject commit 230f069aa4f957d57bc6aa37c80099be3ed28489