Commit 889bac06 authored by Kim, Subin's avatar Kim, Subin
Browse files

console.log 삭제 및 getListfromDB 추가

parent d6d0949f
...@@ -10,23 +10,24 @@ const getAllfromTM = async () => { ...@@ -10,23 +10,24 @@ const getAllfromTM = async () => {
const { data } = await axios.get(`${baseUrl}/api/movie/all`, payload) const { data } = await axios.get(`${baseUrl}/api/movie/all`, payload)
return data return data
} }
const getMoviesfromTM = async (category) => { const getMoviesfromTM = async (category) => {
console.log(category)
const response = await axios.get(`${baseUrl}/api/movie/showmovies/${category}`) const response = await axios.get(`${baseUrl}/api/movie/showmovies/${category}`)
console.log(response.data)
return response.data return response.data
} }
const getMovieInfofromTM = async (id) => { const getMovieInfofromTM = async (id) => {
const movieId = id const movieId = id
const response = await axios.get(`${TMDBUrl}/${movieId}?api_key=${process.env.REACT_APP_TMDB_API_KEY}&language=ko-KR`) const response = await axios.get(`${TMDBUrl}/${movieId}?api_key=${process.env.REACT_APP_TMDB_API_KEY}&language=ko-KR`)
console.log(response.data)
return response.data return response.data
} }
const getImagesfromTM = async (id) => { const getImagesfromTM = async (id) => {
const movieId = id const movieId = id
const response = await axios.get(`${TMDBUrl}/${movieId}/images?api_key=${process.env.REACT_APP_TMDB_API_KEY}`) const response = await axios.get(`${TMDBUrl}/${movieId}/images?api_key=${process.env.REACT_APP_TMDB_API_KEY}`)
return response.data return response.data
} }
const getCreditsfromTM = async (id) =>{ const getCreditsfromTM = async (id) =>{
const movieId = id const movieId = id
const response = await axios.get(`${TMDBUrl}/${movieId}/credits?api_key=${process.env.REACT_APP_TMDB_API_KEY}`) const response = await axios.get(`${TMDBUrl}/${movieId}/credits?api_key=${process.env.REACT_APP_TMDB_API_KEY}`)
...@@ -39,9 +40,14 @@ const getVideosfromTM = async (id) =>{ ...@@ -39,9 +40,14 @@ const getVideosfromTM = async (id) =>{
return response.data.results return response.data.results
} }
const getListfromDB = async () => {
const { data } = await axios.get(`${baseUrl}/api/movie`)
return data
}
const submit = async (movieId) => { const submit = async (movieId) => {
const { data } = await axios.post(`${baseUrl}/api/movie/${movieId}`) const { data } = await axios.post(`${baseUrl}/api/movie/${movieId}`)
console.log("data==", data) return data
} }
const remove = async (movieId) => { const remove = async (movieId) => {
...@@ -66,6 +72,7 @@ const movieApi = { ...@@ -66,6 +72,7 @@ const movieApi = {
getImagesfromTM, getImagesfromTM,
getCreditsfromTM, getCreditsfromTM,
getVideosfromTM, getVideosfromTM,
getListfromDB,
submit, submit,
remove, remove,
search, search,
......
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