mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
added notifications
This commit is contained in:
@@ -3,6 +3,8 @@ import {useForm} from '@mantine/form';
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import {NewItem} from "./types.ts";
|
||||
import { useNavigate} from "react-router";
|
||||
import { IconX, IconCheck } from '@tabler/icons-react';
|
||||
import { notifications } from '@mantine/notifications';
|
||||
|
||||
function AddItem() {
|
||||
|
||||
@@ -33,11 +35,26 @@ function AddItem() {
|
||||
});
|
||||
|
||||
if (result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconCheck size={20} />,
|
||||
color:"teal",
|
||||
title: "All good!",
|
||||
message: "Item Created",
|
||||
position: 'top-center',
|
||||
});
|
||||
navigate("/inventory");
|
||||
|
||||
}
|
||||
|
||||
if (!result.ok) {
|
||||
throw new Error('Failed to update inventory item');
|
||||
notifications.show({
|
||||
icon: <IconX size={20} />,
|
||||
color:"red",
|
||||
title: "Bummer!",
|
||||
message: "Something went wrong",
|
||||
position: 'top-center',
|
||||
});
|
||||
throw new Error('Failed to create inventory item');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user