Skip to content

Commit

Permalink
docs: Throw error or mutation doesn't see any the 500 coming from API (
Browse files Browse the repository at this point in the history
…#7754)

* Throw error or mutation doesn't see any the 500 coming from API

* fix: prettier

* ci: apply automated fixes

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 18, 2024
1 parent 98d127a commit b970f67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/react/optimistic-updates-ui/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ function Example() {
body: JSON.stringify({ text: newTodo }),
headers: { 'Content-Type': 'application/json' },
})
if (!response.ok) {
throw new Error('Something went wrong.')
}
return await response.json()
},
onSettled: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
Expand Down

0 comments on commit b970f67

Please sign in to comment.