From 2133253836de428e58b4ba1c9b7e863485b6b870 Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Sat, 21 Sep 2024 08:00:39 -0700 Subject: Use snackbar globally --- client/src/components/GuestLogin.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'client/src/components/GuestLogin.tsx') diff --git a/client/src/components/GuestLogin.tsx b/client/src/components/GuestLogin.tsx index 0d3e8b1..9a9bf8e 100644 --- a/client/src/components/GuestLogin.tsx +++ b/client/src/components/GuestLogin.tsx @@ -5,8 +5,7 @@ import { Button, Paper, TextField, Typography } from '@mui/material'; import { useForm } from 'react-hook-form'; import { setGuest } from '../slices/auth/guestSlice'; import { useLoginGuestMutation } from '../slices/api/guestSlice'; -import Status from './Status'; -import { open } from '../slices/snackbarSlice'; +import { showSnackbar } from '../slices/snackbarSlice'; import { isFetchBaseQueryError } from '../error'; import type { Data } from '../error'; import type { Name } from '../models'; @@ -34,14 +33,14 @@ function GuestLogin() { } catch (error) { if (isFetchBaseQueryError(error)) { dispatch( - open({ + showSnackbar({ message: (error.data as Data).message, severity: 'error', }) ); } else { dispatch( - open({ + showSnackbar({ message: 'No response', severity: 'error', }) @@ -99,7 +98,6 @@ function GuestLogin() { - ); -- cgit v1.2.3