Hello,
I’m having troubles with a react tailwind project that works well on local but not when deployed.
Normally, you add a city name, the app fetch data with the open weather map api to display weather information. There can be only one among 3 components : loading, error and forecast.
Loading during the fetch while waiting for a response
Error if API response is an error (like no API key, wrong URL…)
Forecast with the weather information from the API
Except that when you try to put the name of a city or anything else, there will always be the “loading” component that will be displayed endlessly. While trying to debug my program I realize that the app blocks at the first await fetch to the open weather map api ( in the src/hooks/useForecast.js).
const API_call = await fetch(`http://api.openweathermap.org/data/2.5/weather?q=${location}&appid=${API_key}&units=metric`);
console.log(API_call);
Why do I think that ? Because there is never a console log with the API call not even for an error. If anayone has an idea to help me, I would be very grateful.
I already check it’s not an API key problem. For a same endpoint the fetch will work on local but not on deployment…
github of my project : GitHub - Romainl01/weather_app: Weather forecast app
netlify of my project : https://distracted-easley-25a066.netlify.app/
Let me know if you need more information
Thank you in advance for your time !
Ps : Sorry if my english is not perfect