Skip to content

Commit d539b33

Browse files
committed
Fix query parameter separator in API fetch URLs
1 parent 3c05b1b commit d539b33

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

includes/admin/js/classic-sections-metabox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@
341341
inflightKey = key;
342342
renderSections([]);
343343

344-
apiFetch({ url: `${config.endpoint}?products=${encodeURIComponent(key)}` })
344+
const separator = config.endpoint.indexOf('?') !== -1 ? '&' : '?';
345+
apiFetch({ url: `${config.endpoint}${separator}products=${encodeURIComponent(key)}` })
345346
.then((terms) => {
346347
if (inflightKey !== key) {
347348
return;

includes/admin/js/classic-sections-metabox.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/admin/js/editor-sections-panel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ let wzkbSectionsNonceMiddlewareAdded = false;
135135
}));
136136

137137
const query = encodeURIComponent(productKey);
138+
const separator = config.endpoint.indexOf('?') !== -1 ? '&' : '?';
138139

139-
apiFetch({ url: config.endpoint + '?products=' + query })
140+
apiFetch({ url: config.endpoint + separator + 'products=' + query })
140141
.then((terms) => {
141142
if (isCancelled) {
142143
return;

includes/admin/js/editor-sections-panel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)