@dotcms/client 0.0.1-beta.4 → 0.0.1-beta.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/next.cjs.js +6 -6
- package/next.esm.js +6 -6
- package/package.json +1 -1
package/next.cjs.js
CHANGED
|
@@ -330,12 +330,12 @@ async function _PageClient_getPageFromAPI(path, params) {
|
|
|
330
330
|
if (!path) {
|
|
331
331
|
throw new Error("The 'path' parameter is required for the Page API");
|
|
332
332
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
const url = `${this.dotcmsUrl}/api/v1/page/json
|
|
333
|
+
const normalizedParams = transforms.__classPrivateFieldGet(this, _PageClient_instances, "m", _PageClient_mapToBackendParams).call(this, params || {});
|
|
334
|
+
const queryParams = new URLSearchParams(normalizedParams).toString();
|
|
335
|
+
// If the path starts with a slash, remove it to avoid double slashes in the final URL
|
|
336
|
+
// Because the page path is part of api url path
|
|
337
|
+
const pagePath = path.startsWith('/') ? path.slice(1) : path;
|
|
338
|
+
const url = `${this.dotcmsUrl}/api/v1/page/json/${pagePath}?${queryParams}`;
|
|
339
339
|
const response = await fetch(url, this.requestOptions);
|
|
340
340
|
if (!response.ok) {
|
|
341
341
|
const error = {
|
package/next.esm.js
CHANGED
|
@@ -328,12 +328,12 @@ async function _PageClient_getPageFromAPI(path, params) {
|
|
|
328
328
|
if (!path) {
|
|
329
329
|
throw new Error("The 'path' parameter is required for the Page API");
|
|
330
330
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const
|
|
336
|
-
const url = `${this.dotcmsUrl}/api/v1/page/json
|
|
331
|
+
const normalizedParams = __classPrivateFieldGet(this, _PageClient_instances, "m", _PageClient_mapToBackendParams).call(this, params || {});
|
|
332
|
+
const queryParams = new URLSearchParams(normalizedParams).toString();
|
|
333
|
+
// If the path starts with a slash, remove it to avoid double slashes in the final URL
|
|
334
|
+
// Because the page path is part of api url path
|
|
335
|
+
const pagePath = path.startsWith('/') ? path.slice(1) : path;
|
|
336
|
+
const url = `${this.dotcmsUrl}/api/v1/page/json/${pagePath}?${queryParams}`;
|
|
337
337
|
const response = await fetch(url, this.requestOptions);
|
|
338
338
|
if (!response.ok) {
|
|
339
339
|
const error = {
|