Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions debug_toolbar/static/debug_toolbar/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,21 @@ const djdt = {
const origFetch = window.fetch;
window.fetch = function (...args) {
const promise = origFetch.apply(this, args);
promise.then((response) => {
if (response.headers.get("djdt-store-id") !== null) {
handleAjaxResponse(response.headers.get("djdt-store-id"));
}
// Don't resolve the response via .json(). Instead
// continue to return it to allow the caller to consume as needed.
return response;
});
promise
.then((response) => {
if (response.headers.get("djdt-store-id") !== null) {
handleAjaxResponse(
response.headers.get("djdt-store-id")
);
}
// Don't resolve the response via .json(). Instead
// continue to return it to allow the caller to consume as needed.
return response;
})
.catch((err) => {
if (err.name === "AbortError") return;
throw e;
});
return promise;
};
},
Expand Down