Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only dispatch FETCH_HEADERS_SUCCESS action on 200 response #1690

Merged
merged 1 commit into from
Jan 4, 2023
Merged
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
18 changes: 13 additions & 5 deletions src/apps/code-editor/src/store/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ export function fetchHeaders() {
type: "FETCH_RESOURCE",
uri: `${CONFIG.API_INSTANCE}/web/headers`,
handler: (res) => {
dispatch({
type: "FETCH_HEADERS_SUCCESS",
payload: res.data,
});

if (res.status === 200) {
dispatch({
type: "FETCH_HEADERS_SUCCESS",
payload: res.data,
});
} else {
dispatch(
notify({
kind: "warn",
message: `Failed to load headers. ${res.status}`,
})
);
}
return res;
},
});
Expand Down