Commit 228698d4 authored by Kim, Subin's avatar Kim, Subin
Browse files

관람료 정보 불러오기

parent 07d957af
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import TicketFeeTable from '../components/Admin/TicketFeeTable' import TicketFeeTable from '../components/Admin/TicketFeeTable'
import TheaterInfo from '../components/TheaterInfo' import TheaterInfo from '../components/TheaterInfo'
import cinemaApi from "../apis/cinema.api.js"
import theaterApi from '../apis/theater.api.js' import theaterApi from '../apis/theater.api.js'
import catchErrors from "../utils/catchErrors.js"; import catchErrors from "../utils/catchErrors.js"
const TheaterPage = () => { const TheaterPage = () => {
const [theaterTypeList, setTheaterTypeList] = useState([]) const [theaterTypeList, setTheaterTypeList] = useState([])
const [ticketFeeInfo, setTicketFeeInfo] = useState("")
const [state, setState] = useState(0) const [state, setState] = useState(0)
const [selectTheater, setSelectTheater] = useState(0) const [selectTheater, setSelectTheater] = useState(0)
const [error, setError] = useState("") const [error, setError] = useState("")
useEffect(() => { useEffect(() => {
getTicketFeeInfo() getTicketFeeInfo()
getTheaterType()
}, []) }, [])
async function getTicketFeeInfo() { async function getTheaterType() {
try { try {
setError("") setError("")
const res = await theaterApi.getTheaterType() const res = await theaterApi.getTheaterType()
...@@ -24,8 +27,18 @@ const TheaterPage = () => { ...@@ -24,8 +27,18 @@ const TheaterPage = () => {
} }
} }
async function getTicketFeeInfo() {
try {
setError("")
const res = await cinemaApi.getCinemaInfo()
setTicketFeeInfo(res.moreFeeInfo)
} catch (error) {
catchErrors(error, setError)
}
}
return ( return (
<div> <>
<div> <div>
<ul className="nav nav-tabs justify-content-center my-4 border-0" id="myTab" role="tablist"> <ul className="nav nav-tabs justify-content-center my-4 border-0" id="myTab" role="tablist">
<li className="nav-item" role="presentation"> <li className="nav-item" role="presentation">
...@@ -56,11 +69,12 @@ const TheaterPage = () => { ...@@ -56,11 +69,12 @@ const TheaterPage = () => {
</ol> </ol>
</nav> </nav>
<TicketFeeTable selectTheater={selectTheater} /> <TicketFeeTable selectTheater={selectTheater} />
<div className="text-start mt-5" style={{ whiteSpace: "pre-line" }}>{ticketFeeInfo}</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </>
) )
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment