Skip to content

Commit

Permalink
Api route fix (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffersonBledsoe authored Jun 11, 2023
1 parent b89bc28 commit 141abc9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/customizations/volto/helpers/Api/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class Api {

Object.keys(headers).forEach((key) => request.set(key, headers[key]));

if (__SERVER__ && checkUrl && ['get', 'head'].includes(method)) {
request.redirects(0);
}

if (data) {
request.send(data);
}
Expand Down Expand Up @@ -140,6 +144,12 @@ class Api {
url: request.xhr.responseURL,
});
}
if (err?.status[0] === 3) {
return reject({
code: err.status,
url: err.response.headers.location,
});
}
return err ? reject(err) : resolve(response.body || response.text);
});
});
Expand Down

0 comments on commit 141abc9

Please sign in to comment.