Skip to content

Commit 74c9add

Browse files
committed
add default onError to mutations
1 parent a5f8904 commit 74c9add

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

app/src/components/addNote.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ export const AddNote: VoidComponent<{
134134
assertNever(props.type)
135135
}
136136
},
137-
onError: () => {
138-
C.toastError('Error occurred while saving, see console for details.')
139-
},
140137
}))
141138
return (
142139
<>

app/src/components/editTemplate.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ const saveButton = (props: {
3636
assertNever(props.type)
3737
}
3838
},
39-
onError: () => {
40-
C.toastError('Error occurred while saving, see console for details.')
41-
},
4239
}))
4340
const deleteTemplate = createMutation(() => ({
4441
mutationFn: async () => {
@@ -47,9 +44,6 @@ const saveButton = (props: {
4744
onSuccess: () => {
4845
setTemplateRowDelta(-1)
4946
},
50-
onError: () => {
51-
C.toastError('Error occurred while deleting, see console for details.')
52-
},
5347
}))
5448
return (
5549
<div class='flex justify-between'>

app/src/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import { TableCountProvider } from './components/tableCountContext'
1010
import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
1111

1212
const client = new QueryClient({
13-
defaultOptions: { queries: { throwOnError: true } },
13+
defaultOptions: {
14+
queries: { throwOnError: true },
15+
mutations: {
16+
onError(error) {
17+
C.toastError(error.message, error)
18+
},
19+
},
20+
},
1421
})
1522

1623
render(

0 commit comments

Comments
 (0)