summaryrefslogtreecommitdiff
path: root/client/src/components/RsvpForm.tsx
diff options
context:
space:
mode:
authorMichael Hunteman <michael@huntm.net>2024-09-21 08:00:39 -0700
committerMichael Hunteman <michael@huntm.net>2024-09-21 11:39:18 -0700
commit2133253836de428e58b4ba1c9b7e863485b6b870 (patch)
tree9c175fd811975a21fcf60a5b14004443d32fe989 /client/src/components/RsvpForm.tsx
parenta54a93b724a6104213b17271fc298e37adedc1c5 (diff)
Use snackbar globally
Diffstat (limited to 'client/src/components/RsvpForm.tsx')
-rw-r--r--client/src/components/RsvpForm.tsx10
1 files changed, 4 insertions, 6 deletions
diff --git a/client/src/components/RsvpForm.tsx b/client/src/components/RsvpForm.tsx
index fd7bcd5..b3ff0db 100644
--- a/client/src/components/RsvpForm.tsx
+++ b/client/src/components/RsvpForm.tsx
@@ -17,8 +17,7 @@ import MailIcon from '@mui/icons-material/Mail';
import { useForm, Controller, useFieldArray } from 'react-hook-form';
import { useUpdateGuestMutation } from '../slices/api/guestSlice';
import { isFetchBaseQueryError } from '../error';
-import Status from './Status';
-import { open } from '../slices/snackbarSlice';
+import { showSnackbar } from '../slices/snackbarSlice';
import type { Data } from '../error';
import type { Guest } from '../models';
@@ -51,7 +50,7 @@ function RsvpForm() {
try {
await updateGuest({ ...data }).unwrap();
dispatch(
- open({
+ showSnackbar({
message: 'RSVP updated',
severity: 'success',
})
@@ -59,14 +58,14 @@ function RsvpForm() {
} catch (error) {
if (isFetchBaseQueryError(error)) {
dispatch(
- open({
+ showSnackbar({
message: (error.data as Data).message,
severity: 'error',
})
);
} else {
dispatch(
- open({
+ showSnackbar({
message: 'RSVP failed',
severity: 'error',
})
@@ -276,7 +275,6 @@ function RsvpForm() {
</Button>
</div>
</Grid>
- <Status />
</Grid>
</Paper>
</form>