Commit 5f60aebc authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

movie apis

parent 711c9c42
......@@ -5,6 +5,12 @@ const getUpcomingfromTM = async () => {
const { data } = await axios.get(`${TMDBUrl}/upcoming?api_key=${process.env.REACT_APP_TMDB_API_KEY}&language=ko-KR`)
return data.results
}
const getfromTM = async (cate) => {
const category = cate
const response = await axios.get(`${baseUrl}/api/movie/showmovie/${category}`)
console.log(response.data)
return response.data
}
const submit = async (movieId) => {
const { data } = await axios.post(`${baseUrl}/api/movie/${movieId}`)
......@@ -13,6 +19,7 @@ const submit = async (movieId) => {
const movieApi = {
getUpcomingfromTM,
getfromTM,
submit
}
......
import React, { useState, useEffect } from 'react'
import axios from 'axios'
import {baseUrl} from '../../utils/baseUrl.js'
import { useState, useEffect } from 'react'
import movieApi from '../../apis/movie.api.js'
import { Link } from 'react-router-dom';
import styles from "./movieChart.module.scss"
......@@ -11,11 +10,11 @@ const MovieChart = () => {
}, [])
async function getTMDB_TopRated() {
const category = "popular"
const category="popular"
try {
const response = await axios.get(`${baseUrl}/api/movie/showmovie/${category}`)
console.log(response.data)
setTMDB_TopRated_Data([...response.data])
const data = await movieApi.getfromTM(category)
console.log(data)
setTMDB_TopRated_Data(data)
} catch (error) {
}
......
import React from 'react'
import styles from "./ticketingTheater.module.scss"
const TicketingTheater = (props) => {
......
import React, { useState } from 'react'
import { useState } from 'react'
import TicketingMovie from "../components/TicketingMovie/TicketingMovie"
import TicketingTheater from "../components/TicketingTheater/TicketingTheater"
import TicketingTimeTable from "../components/TicketingTimeTable"
......
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