From 2133253836de428e58b4ba1c9b7e863485b6b870 Mon Sep 17 00:00:00 2001
From: Michael Hunteman <michael@huntm.net>
Date: Sat, 21 Sep 2024 08:00:39 -0700
Subject: Use snackbar globally

---
 client/src/components/RsvpForm.tsx | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'client/src/components/RsvpForm.tsx')

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>
-- 
cgit v1.2.3

