WildCodeSchool / 2022-09-Orleans-CDA-Projet-Frontend-EDPK

2 stars 0 forks source link

Navbar issue #29

Closed epereira closed 2 years ago

epereira commented 2 years ago

Des requêtes sont lancées pour rien dans la navbar, à chaque page appelée, ce qui fait tout bugger. à corriger !

const Navbar = () => {
  const [isShow, setShow] = useState(false);
  const [category, setCategory] = useState("");

  useEffect(() => {
    axios
      .get(
        `https://api.themoviedb.org/3/genre/movie/list?api_key=${
          import.meta.env.VITE_API_KEY
        }&language=en-US`
      )
      .then((response) => response.data)
      .then((data) => {
        setCategory(data.genres);
      });
  }, []);
epereira commented 2 years ago

Access to XMLHttpRequest at 'https://api.themoviedb.org/3/genre/movie/list?api_key=97500ec1d5904dcd30515fe90c909e34&language=en-US' from origin 'http://127.0.0.1:5173' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values ', ', but only one is allowed.