add envioment variables
This commit is contained in:
parent
9bf8039422
commit
6646b17097
5 changed files with 30 additions and 22 deletions
|
@ -1,5 +1,4 @@
|
|||
import { useEffect, useState } from "react"
|
||||
import config from "config"
|
||||
import styles from "styles/Actor.module.css"
|
||||
import { Link, useParams } from "react-router-dom"
|
||||
import { GENRES } from "../constants"
|
||||
|
@ -15,7 +14,9 @@ const Actor = () => {
|
|||
useEffect(() => {
|
||||
const run = async () => {
|
||||
const response = await fetch(
|
||||
`https://api.themoviedb.org/3/person/${actorId}?api_key=${config.apiKey}`
|
||||
`https://api.themoviedb.org/3/person/${actorId}?api_key=${
|
||||
import.meta.env.VITE_APIKEY
|
||||
}`
|
||||
)
|
||||
const data = await response.json()
|
||||
setActor(data)
|
||||
|
@ -26,7 +27,9 @@ const Actor = () => {
|
|||
useEffect(() => {
|
||||
const run = async () => {
|
||||
const response = await fetch(
|
||||
`https://api.themoviedb.org/3/person/${actorId}/images?api_key=${config.apiKey}`
|
||||
`https://api.themoviedb.org/3/person/${actorId}/images?api_key=${
|
||||
import.meta.env.VITE_APIKEY
|
||||
}`
|
||||
)
|
||||
const data = await response.json()
|
||||
setImages(data)
|
||||
|
@ -37,7 +40,9 @@ const Actor = () => {
|
|||
useEffect(() => {
|
||||
const run = async () => {
|
||||
const response = await fetch(
|
||||
`https://api.themoviedb.org/3/person/${actorId}/movie_credits?api_key=${config.apiKey}`
|
||||
`https://api.themoviedb.org/3/person/${actorId}/movie_credits?api_key=${
|
||||
import.meta.env.VITE_APIKEY
|
||||
}`
|
||||
)
|
||||
const data = await response.json()
|
||||
setCredits(
|
||||
|
|
|
@ -2,7 +2,6 @@ import TopBar from "components/TopBar"
|
|||
import useDebounce from "hooks/useDebounce"
|
||||
import { useEffect, useState } from "react"
|
||||
import styles from "styles/Home.module.css"
|
||||
import config from "config"
|
||||
import Card from "components/Card"
|
||||
|
||||
const Home = () => {
|
||||
|
@ -17,7 +16,7 @@ const Home = () => {
|
|||
`https://api.themoviedb.org/3/${
|
||||
debouncedSearch ? "search" : "discover"
|
||||
}/movie?api_key=${
|
||||
config.apiKey
|
||||
import.meta.env.VITE_APIKEY
|
||||
}&page=${page}&query=${encodeURIComponent(debouncedSearch)}`
|
||||
)
|
||||
const data = await response.json()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { useEffect, useState } from "react"
|
||||
import { Link, useParams } from "react-router-dom"
|
||||
import styles from "styles/Movie.module.css"
|
||||
import config from "config"
|
||||
import useLocalStorage from "hooks/useLocalStorage"
|
||||
import Rate from "components/Rate"
|
||||
import TopBar from "components/TopBar"
|
||||
|
@ -22,7 +21,9 @@ const Movie = () => {
|
|||
useEffect(() => {
|
||||
const run = async () => {
|
||||
const response = await fetch(
|
||||
`https://api.themoviedb.org/3/movie/${movieId}?api_key=${config.apiKey}`
|
||||
`https://api.themoviedb.org/3/movie/${movieId}?api_key=${
|
||||
import.meta.env.VITE_APIKEY
|
||||
}`
|
||||
)
|
||||
const data = await response.json()
|
||||
setMovie({
|
||||
|
@ -47,7 +48,9 @@ const Movie = () => {
|
|||
useEffect(() => {
|
||||
const run = async () => {
|
||||
const response = await fetch(
|
||||
`https://api.themoviedb.org/3/movie/${movieId}/credits?api_key=${config.apiKey}`
|
||||
`https://api.themoviedb.org/3/movie/${movieId}/credits?api_key=${
|
||||
import.meta.env.VITE_APIKEY
|
||||
}`
|
||||
)
|
||||
const data = await response.json()
|
||||
setCast(data.cast)
|
||||
|
|
Reference in a new issue