@doujins/payments-ui 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -120,13 +120,15 @@ var createClient = (config) => {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
const buildUrl = (path, query) => {
|
|
123
|
-
|
|
124
|
-
const
|
|
123
|
+
const sanitizedPath = path.replace(/^\/+/, "");
|
|
124
|
+
const baseUrl = config.baseUrl.trim().replace(/\/+$/, "");
|
|
125
|
+
const versionedBaseUrl = baseUrl.endsWith("/v1") ? baseUrl : `${baseUrl}/v1`;
|
|
126
|
+
const url = new URL(sanitizedPath, `${versionedBaseUrl.replace(/\/+$/, "")}/`);
|
|
125
127
|
if (query) {
|
|
126
|
-
|
|
127
|
-
if (value === void 0 || value === null)
|
|
128
|
+
for (const [key, value] of Object.entries(query)) {
|
|
129
|
+
if (value === void 0 || value === null) continue;
|
|
128
130
|
url.searchParams.append(key, String(value));
|
|
129
|
-
}
|
|
131
|
+
}
|
|
130
132
|
}
|
|
131
133
|
return url.toString();
|
|
132
134
|
};
|