source: frontend/src/Components/Hooks/useCreate.js@ ac19a0c

Last change on this file since ac19a0c was e9b4ba9, checked in by darsov2 <62809499+darsov2@…>, 9 months ago

prototype

  • Property mode set to 100644
File size: 806 bytes
Line 
1import axios from "../../axios";
2
3const useCreate = () => {
4
5 //const history = useNavigate();
6 const createEntity = async (url, entity, getData, getData2) => {
7 console.log(entity)
8 await axios
9 .post(url, null, {
10 params: entity,
11 // headers: {
12 // 'Content-Type': 'multipart/form-data'
13 // }
14 })
15 .then((res) => {
16 //history.push('/hotel');
17 console.log(res)
18 getData(prev => ++prev)
19 getData2(prev => ++prev)
20 })
21 .catch((err) => {
22 console.log(err);
23 })
24 .finally(() => {
25 });
26 }
27
28 return {
29 createEntity
30 };
31
32}
33
34export default useCreate;
Note: See TracBrowser for help on using the repository browser.