register + deletions + image request changes

This commit is contained in:
2024-05-13 19:42:49 +02:00
parent baf31f7959
commit 22ec7f8fdd
16 changed files with 220 additions and 87 deletions

View File

@@ -1,6 +1,9 @@
import React, { useState, useEffect } from "react";
import { Form, Input, InputNumber, Button, Select, DatePicker } from "antd";
import axios from "axios";
import { createItem } from '../../api/item'
const { TextArea } = Input;
const { Option } = Select;
@@ -26,16 +29,10 @@ export const FormCreateItem = ({ onClose }) => {
}, []);
const onFinish = async (values) => {
try {
const response = await axios.post(
`${import.meta.env.VITE_API_URL}/item`,
values,
);
console.log(response.data);
} catch (error) {
console.error(error);
}
let response = await createItem(values);
if (response?.status >= 200 && response?.status < 300) {
window.location.reload();
}
};
return (