Skip to content

Commit

Permalink
LPS-128335 Try to parse response only if the response isn't a 204 avo…
Browse files Browse the repository at this point in the history
…iding passing through the catch

I found this solution here whatwg/fetch#113 (comment)
  • Loading branch information
boton authored and brianchandotcom committed Feb 25, 2021
1 parent 51f97d8 commit ed293bf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ const EditTagsModal = ({
};

return fetch(`${pathModule}${url}`, init)
.then((response) => response.json())
.then((response) =>
response.status === 204 ? '' : response.json()
)
.catch(() => {
onModalClose();
});
Expand Down

0 comments on commit ed293bf

Please sign in to comment.