summaryrefslogtreecommitdiff
path: root/client/src/components/Status.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/components/Status.tsx')
-rw-r--r--client/src/components/Status.tsx19
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/components/Status.tsx b/client/src/components/Status.tsx
new file mode 100644
index 0000000..4bb60ff
--- /dev/null
+++ b/client/src/components/Status.tsx
@@ -0,0 +1,19 @@
+import React from 'react';
+import { Alert } from '@mui/material';
+import { isFetchBaseQueryError } from '../error';
+import type { StatusProps } from '../models';
+import type { Data } from '../error';
+
+const Status = ({ error, setOpen, type }: StatusProps) => {
+ return isFetchBaseQueryError(error) ? (
+ <Alert severity="error" onClose={() => setOpen(false)}>
+ {(error.data as Data).message}
+ </Alert>
+ ) : (
+ <Alert severity="error" onClose={() => setOpen(false)}>
+ {`${type} login failed`}
+ </Alert>
+ );
+};
+
+export default Status;