@doujins/payments-ui 0.1.5 → 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 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -120,14 +120,15 @@ var createClient = (config) => {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
const buildUrl = (path, query) => {
|
|
123
|
-
|
|
124
|
-
const baseUrl = config.baseUrl.replace(
|
|
125
|
-
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(/\/+$/, "")}/`);
|
|
126
127
|
if (query) {
|
|
127
|
-
|
|
128
|
-
if (value === void 0 || value === null)
|
|
128
|
+
for (const [key, value] of Object.entries(query)) {
|
|
129
|
+
if (value === void 0 || value === null) continue;
|
|
129
130
|
url.searchParams.append(key, String(value));
|
|
130
|
-
}
|
|
131
|
+
}
|
|
131
132
|
}
|
|
132
133
|
return url.toString();
|
|
133
134
|
};
|