reservation.api.js 1.23 KB
Newer Older
한규민's avatar
한규민 committed
1
2
3
4
import axios from "axios";
import { baseUrl } from "../utils/baseUrl.js";

const findReservedSeats = async (timeTable) => {
Jiwon Yoon's avatar
Jiwon Yoon committed
5
    console.log(timeTable)
한규민's avatar
한규민 committed
6
    const url = `${baseUrl}/api/reservation/findreservation`;
7
    const { data } = await axios.post(url, { timeTable: timeTable });
한규민's avatar
한규민 committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    return data
}

const findReservation = async () => {
    const url = `${baseUrl}/api/reservation/findreservation`;
    const { data } = await axios.get(url);
    return data
}

const findOneReservation = async () => {
    const url = `${baseUrl}/api/reservation/findonereservation`;
    const { data } = await axios.get(url);
    return data
}

const save = async (save) => {
    const url = `${baseUrl}/api/reservation/save`;
    const { data } = await axios.post(url, save);
    return data
27
}
한규민's avatar
한규민 committed
28

29
30
31
32
const saveTid = async (tid) => {
    const url = `${baseUrl}/api/reservation/savetid`;
    const { data } = await axios.post(url, tid);
    return data
한규민's avatar
한규민 committed
33
}
34
35
36
37
38
39
40
41

const deleteReservation = async () => {
    const url = `${baseUrl}/api/reservation/delete`;
    const { data } = await axios.get(url);
    return data
}

const reservationApi = {
한규민's avatar
한규민 committed
42
43
44
    findReservation,
    findReservedSeats,
    findOneReservation,
45
46
47
    save,
    saveTid,
    deleteReservation
한규민's avatar
한규민 committed
48
49
}
export default reservationApi