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:
675 bytes
|
Rev | Line | |
---|
[e9b4ba9] | 1 | import React from "react";
|
---|
| 2 | import axios from "../../../axios";
|
---|
| 3 | import { useNavigate } from 'react-router-dom';
|
---|
| 4 |
|
---|
| 5 | const useCreateTable = () => {
|
---|
| 6 |
|
---|
| 7 | const createTable = async (id, table, refresh) => {
|
---|
| 8 | console.log(table)
|
---|
| 9 | await axios
|
---|
| 10 | .post(`/restaurant/table/${id}/add`, null, {
|
---|
| 11 | params: table
|
---|
| 12 | })
|
---|
| 13 | .then((res) => {
|
---|
| 14 | console.log(res)
|
---|
| 15 | refresh(prev => ++prev)
|
---|
| 16 | //history.push('/restaurant');
|
---|
| 17 | })
|
---|
| 18 | .catch((err) => {
|
---|
| 19 | console.log(err);
|
---|
| 20 | })
|
---|
| 21 | .finally(() => {
|
---|
| 22 | });
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | return {
|
---|
| 26 | createTable
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | export default useCreateTable; |
---|
Note:
See
TracBrowser
for help on using the repository browser.