mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
fixed stupid, also page redirect
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user