mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 09:25:47 +01:00
🥅 Add alert when procedure failed
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Button, Card, Group, Table, Text, Title } from '@mantine/core';
|
||||
import { Alert, Button, Card, Group, Table, Text, Title } from '@mantine/core';
|
||||
import {
|
||||
IconAlertTriangle,
|
||||
IconAlertTriangleFilled,
|
||||
IconArrowLeft,
|
||||
IconCheck,
|
||||
IconInfoCircle,
|
||||
@@ -21,7 +23,7 @@ export const ReviewInputStep = ({ values, prevStep, nextStep }: ReviewInputStepP
|
||||
const { t } = useTranslation('manage/users/create');
|
||||
|
||||
const utils = api.useContext();
|
||||
const { mutateAsync: createAsync, isLoading } = api.user.create.useMutation({
|
||||
const { mutateAsync: createAsync, isLoading, isError, error } = api.user.create.useMutation({
|
||||
onSettled: () => {
|
||||
void utils.user.all.invalidate();
|
||||
},
|
||||
@@ -87,6 +89,12 @@ export const ReviewInputStep = ({ values, prevStep, nextStep }: ReviewInputStepP
|
||||
</tbody>
|
||||
</Table>
|
||||
|
||||
{isError && (
|
||||
<Alert color="red" icon={<IconAlertTriangleFilled size="0.9rem" />} mb="lg">
|
||||
<Text color="red">User creation has failed: {error.message}</Text>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<Group position="apart" noWrap>
|
||||
<Button leftIcon={<IconArrowLeft size="1rem" />} onClick={prevStep} variant="light" px="xl">
|
||||
{t('common:previous')}
|
||||
|
||||
Reference in New Issue
Block a user