theater.api.js 826 Bytes
Newer Older
Kim, Subin's avatar
theater    
Kim, Subin committed
1
2
3
4
5
6
7
8
import axios from "axios";
import { baseUrl } from "../utils/baseUrl.js";

const getAll = async () => {
    const { data } = await axios.get(`${baseUrl}/api/theater`)
    return data
}

Kim, Subin's avatar
Kim, Subin committed
9
10
const getOne = async (theaterId) => {
    const { data } = await axios.get(`${baseUrl}/api/theater/${theaterId}`)
Kim, Subin's avatar
theater    
Kim, Subin committed
11
12
13
14
15
16
17
18
19
    return data
}

const getTheaterType = async () => {
    const { data } = await axios.get(`${baseUrl}/api/theater/type`)
    return data
}

const sendData = async (theater) => {
Kim, Subin's avatar
Kim, Subin committed
20
    const { data } = await axios.put(`${baseUrl}/api/theater`, theater)
Kim, Subin's avatar
theater    
Kim, Subin committed
21
22
23
    return data
}

Kim, Subin's avatar
Kim, Subin committed
24
25
const remove = async (theaterId) => {
    const { data } = await axios.delete(`${baseUrl}/api/theater/${theaterId}`)
Kim, Subin's avatar
theater    
Kim, Subin committed
26
27
28
29
30
31
32
33
34
35
36
37
    return data
}

const theaterApi = {
    getAll,
    getOne,
    getTheaterType,
    sendData,
    remove
}

export default theaterApi