fixed stupid, also page redirect

This commit is contained in:
2025-01-29 20:33:37 -06:00
parent 73d58aea4f
commit a4a038f8bc
3 changed files with 10 additions and 3 deletions
@@ -2,9 +2,12 @@ import {Button, Group, TextInput, NumberInput, Container, Title, Flex} from '@ma
import {useForm} from '@mantine/form';
import {useMutation} from "@tanstack/react-query";
import {NewItem} from "./types.ts";
import { useNavigate} from "react-router";
function AddItem() {
const navigate = useNavigate();
const newItemForm = useForm<NewItem>({
mode: 'uncontrolled',
initialValues: {
@@ -29,6 +32,10 @@ function AddItem() {
}
});
if (result.ok) {
navigate("/inventory");
}
if (!result.ok) {
throw new Error('Failed to update inventory item');
}