ReservationDetails.js 2.08 KB
Newer Older
한규민's avatar
한규민 committed
1
2
import { useState, useEffect } from "react";
import reservationApi from "../../apis/reservation.api";
한규민's avatar
한규민 committed
3
4
import styles from "./reservation-details.module.scss";
const ReservationDetails = () => {
한규민's avatar
한규민 committed
5
6
7
8
9
10
11
12
13
14
15
16

    const [movies, setMovies] = useState([]);
    const findReservaion = async () => {
        const movieList = await reservationApi.findOneReservation();
        setMovies(movieList);
    }


    useEffect(() => {
        findReservaion();
    }, [])

17
18
19
    return (
        <div className={`d-flex flex-column align-items-center ${styles.width}`}>
            <div className={`${styles.header}`}>나의 예매 내역</div>
한규민's avatar
한규민 committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
            {movies.length > 0
                ? movies.map(movie => (
                    <div className={`${styles.body}`}>
                        <div className={`d-flex justify-content-around align-items-center py-3`}>
                            <div className={`${styles.span} d-flex justify-content-center`}>
                                <img src={`https://image.tmdb.org/t/p/original${movie.poster_path}`} className={`card-img-top rounded ${styles.poster}`} alt="Movie Poster" />
                            </div>
                            <div className={`${styles.span} d-flex flex-column`}>
                                <span className={`${styles.layout}`}>{movie.title}</span>
                                <span className={`${styles.layout}`}>예매확인번호</span>
                                <span className={`${styles.layout}`}></span>
                                <span className={`${styles.layout}`}></span>
                                <span className={`${styles.layout}`}>{movie.row} {movie.col}</span>
                                <span className={`${styles.layout}`}>결제금액</span>
                                <span className={`${styles.layout}`}>{movie.payment}</span>
                            </div>
                        </div>
37
                    </div>
한규민's avatar
한규민 committed
38
39
                ))
                : <div className={`${styles.layout}`}>예매 내역이 존재하지 않습니다.</div>}
40
        </div>
한규민's avatar
한규민 committed
41
42
43
44
    )
}

export default ReservationDetails