Last change
on this file since efaa053 was 0f5aa27, checked in by darsov2 <62809499+darsov2@…>, 15 months ago |
ouath, mailing impl
|
-
Property mode
set to
100644
|
File size:
807 bytes
|
Line | |
---|
1 | import React from "react";
|
---|
2 | import axios from "../../../axios";
|
---|
3 | import { useNavigate } from 'react-router-dom';
|
---|
4 |
|
---|
5 | const useCreateMenu = () => {
|
---|
6 |
|
---|
7 | const navigator = useNavigate();
|
---|
8 |
|
---|
9 | const createMenu = async (id, menu, dep) => {
|
---|
10 | console.log(menu)
|
---|
11 | console.log(id)
|
---|
12 | await axios
|
---|
13 | .post(`/restaurant/` + id + "/menu/add", menu)
|
---|
14 | .then((res) => {
|
---|
15 | console.log("NOVO MENI");
|
---|
16 | console.log(res)
|
---|
17 | //window.location.reload()
|
---|
18 | //navigator("/resources/restaurant/" + id)
|
---|
19 | //history.push('/restaurant');
|
---|
20 | dep(prev => ++prev)
|
---|
21 | })
|
---|
22 | .catch((err) => {
|
---|
23 | console.log(err);
|
---|
24 | })
|
---|
25 | .finally(() => {
|
---|
26 | });
|
---|
27 | }
|
---|
28 |
|
---|
29 |
|
---|
30 | return {
|
---|
31 | createMenu
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | export default useCreateMenu; |
---|
Note:
See
TracBrowser
for help on using the repository browser.