@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.js
CHANGED
|
@@ -88,14 +88,15 @@ var createClient = (config) => {
|
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
const buildUrl = (path, query) => {
|
|
91
|
-
|
|
92
|
-
const baseUrl = config.baseUrl.replace(
|
|
93
|
-
const
|
|
91
|
+
const sanitizedPath = path.replace(/^\/+/, "");
|
|
92
|
+
const baseUrl = config.baseUrl.trim().replace(/\/+$/, "");
|
|
93
|
+
const versionedBaseUrl = baseUrl.endsWith("/v1") ? baseUrl : `${baseUrl}/v1`;
|
|
94
|
+
const url = new URL(sanitizedPath, `${versionedBaseUrl.replace(/\/+$/, "")}/`);
|
|
94
95
|
if (query) {
|
|
95
|
-
|
|
96
|
-
if (value === void 0 || value === null)
|
|
96
|
+
for (const [key, value] of Object.entries(query)) {
|
|
97
|
+
if (value === void 0 || value === null) continue;
|
|
97
98
|
url.searchParams.append(key, String(value));
|
|
98
|
-
}
|
|
99
|
+
}
|
|
99
100
|
}
|
|
100
101
|
return url.toString();
|
|
101
102
|
};
|