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/AdminLogin.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'client/src/components/AdminLogin.tsx') diff --git a/client/src/components/AdminLogin.tsx b/client/src/components/AdminLogin.tsx index 25f2063..83b7de4 100644 --- a/client/src/components/AdminLogin.tsx +++ b/client/src/components/AdminLogin.tsx @@ -5,8 +5,7 @@ import { Button, Paper, TextField, Typography } from '@mui/material'; import { useForm } from 'react-hook-form'; import { setAdmin } from '../slices/auth/adminSlice'; import { useLoginAdminMutation } from '../slices/api/adminSlice'; -import Status from './Status'; -import { open } from '../slices/snackbarSlice'; +import { showSnackbar } from '../slices/snackbarSlice'; import { isFetchBaseQueryError } from '../error'; import type { Credentials } from '../models'; import type { Data } from '../error'; @@ -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', }) @@ -100,7 +99,6 @@ function GuestLogin() { Log in - ); } -- cgit v1.2.3