MovieEdit.js 1.3 KB
Newer Older
1
import { useState, useEffect } from "react";
Kim, Subin's avatar
Kim, Subin committed
2
import Search from "../Search";
Kim, Subin's avatar
Kim, Subin committed
3
4
import MovieTable from "../MovieTable";
import Pagination from "../Pagination";
5
6
import movieApi from "../../apis/movie.api.js";
import catchErrors from "../../utils/catchErrors.js";
7
import styles from "./admin.module.scss";
Kim, Subin's avatar
Kim, Subin committed
8
9

const MovieEdit = () => {
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    const [movieList, setMovieList] = useState([])
    const [error, setError] = useState("")

    useEffect(() => {
        getMovieList()
    }, [])

    async function getMovieList() {
        try {
            setError("");
            const getMovieList = await movieApi.getUpcomingfromTM()
            setMovieList(getMovieList)
        } catch (error) {
            catchErrors(error, setError)
        }
    }

Kim, Subin's avatar
Kim, Subin committed
27
    return (
Kim, Subin's avatar
Kim, Subin committed
28
        <>
29
        {console.log("List==",movieList)}
Kim, Subin's avatar
Kim, Subin committed
30
31
32
            <div className="d-flex justify-content-end mb-3">
                <Search type="admin" />
            </div>
33
            <MovieTable movieList={movieList} />
Kim, Subin's avatar
Kim, Subin committed
34
            <div className="d-flex flex-wrap">
Kim, Subin's avatar
Kim, Subin committed
35
                <Pagination />
Kim, Subin's avatar
Kim, Subin committed
36
                <div className="d-flex justify-content-end col-12 col-md-4 my-2">
37
                    <button type="button" className={`btn btn-dark ${styles.customBtn}`}>등록</button>
Kim, Subin's avatar
Kim, Subin committed
38
                </div>
Kim, Subin's avatar
Kim, Subin committed
39
40
            </div>
        </>
Kim, Subin's avatar
Kim, Subin committed
41
42
43
    )
}
export default MovieEdit