source: frontend/src/Components/Hooks/Hotel/useRemoveHotel.js@ e9b4ba9

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

prototype

  • Property mode set to 100644
File size: 575 bytes
Line 
1import React from "react";
2import axios from "axios";
3import { useHistory } from 'react-router-dom';
4
5const useRemoveHotel = () => {
6
7 const history = useHistory();
8 const removeHotel = async ({id}) => {
9 await axios
10 .get(`/hotel/delete?userId=` + id)
11 .then((res) => {
12 history.push('/hotel');
13 })
14 .catch((err) => {
15 console.log(err);
16 })
17 .finally(() => {
18 });
19 }
20 return (
21 removeHotel
22 )
23
24}
25
26export default useRemoveHotel;
Note: See TracBrowser for help on using the repository browser.