diff --git a/src/store/api-helper.js b/src/store/api-helper.js
index 5117dcf9790ce312d3711b072e57e688e95a182c..2517179310a72f252f0c1f82f80a7d74c67ae1c2 100644
--- a/src/store/api-helper.js
+++ b/src/store/api-helper.js
@@ -90,12 +90,12 @@ export function callOrReturn(response, callback) {
 function createURLBuilder(basepath, useTrailingSlash = true) {
   // Strip all trailing slashes from the basepath.
   // We handle slashes when building URLs.
-  basepath.replace(/\/*$/, '')
+  basepath = basepath.replace(/\/*$/, '')
 
   return function buildURL(...subPaths) {
     let params
     if (subPaths.at(-1) instanceof URLSearchParams) {
-      params = subPaths.unshift()
+      params = subPaths.pop()
     }
     if (subPaths.some((path) => String(path).includes('/'))) {
       throw new Error('Subpaths must not contain slashes')