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:
@@ -87,7 +87,7 @@ inventoryGroup.MapPut("/{id}", async (int id, InventoryItems updatedItem, BarkCo
|
|||||||
inventoryGroup.MapPost("", async (InventoryItems newItemInput, BarkContext db) =>
|
inventoryGroup.MapPost("", async (InventoryItems newItemInput, BarkContext db) =>
|
||||||
{
|
{
|
||||||
var newItem = new InventoryItems();
|
var newItem = new InventoryItems();
|
||||||
newItemInput.Name = newItem.Name;
|
newItem.Name = newItemInput.Name;
|
||||||
newItem.Brand = newItemInput.Brand;
|
newItem.Brand = newItemInput.Brand;
|
||||||
newItem.SerialNumber = newItemInput.SerialNumber;
|
newItem.SerialNumber = newItemInput.SerialNumber;
|
||||||
newItem.RentalPrice = newItemInput.RentalPrice;
|
newItem.RentalPrice = newItemInput.RentalPrice;
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
#Staging API
|
#Staging API
|
||||||
VITE_API_URL=https://barkdev.ts.drewr.io
|
#VITE_API_URL=https://barkdev.ts.drewr.io
|
||||||
#Local Dev API
|
#Local Dev API
|
||||||
#VITE_API_URL=http://localhost:5145
|
VITE_API_URL=http://localhost:5145
|
||||||
@@ -2,9 +2,12 @@ import {Button, Group, TextInput, NumberInput, Container, Title, Flex} from '@ma
|
|||||||
import {useForm} from '@mantine/form';
|
import {useForm} from '@mantine/form';
|
||||||
import {useMutation} from "@tanstack/react-query";
|
import {useMutation} from "@tanstack/react-query";
|
||||||
import {NewItem} from "./types.ts";
|
import {NewItem} from "./types.ts";
|
||||||
|
import { useNavigate} from "react-router";
|
||||||
|
|
||||||
function AddItem() {
|
function AddItem() {
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const newItemForm = useForm<NewItem>({
|
const newItemForm = useForm<NewItem>({
|
||||||
mode: 'uncontrolled',
|
mode: 'uncontrolled',
|
||||||
initialValues: {
|
initialValues: {
|
||||||
@@ -29,6 +32,10 @@ function AddItem() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result.ok) {
|
||||||
|
navigate("/inventory");
|
||||||
|
}
|
||||||
|
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
throw new Error('Failed to update inventory item');
|
throw new Error('Failed to update inventory item');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user