Wanderlust

Hi,

Here is the code
-https://gist.github.com/c6c0e2f3729642e7a25b42ba3fa4d0a3

So, the code is simply not working. These are questions I have

  1. Does API take long? I got a mail from the weather API that it can be used in few hours. I used the key that I got in my email. Is that ok?
  2. The helper file is neither exported or imported into the main.js, yet functions there are called here. Not sure how that works?
  3. Somewhere when I was putting the code in even the empty boxes stopped showing up.

I checked the code against the code in the working project. Not sure what the issue is.

Would appreciate some guidance.

Best Regards
Trishna

I personally struggled with this as well, I think I did have to wait a bit for my API key to work. Are you getting any specific error messages? What step are you stuck on? I glanced over your code and nothing really jumped out at me as being wrong. I can try and compare it against my working version, I did this project a couple weeks ago.

general tip, you usually don’t want to share your api keys, probably doesn’t matter as much in this case, but its a good habit to not share them!

let me know if you still need help with this.

Hi,

Thank you for your reply.

On sharing API keys - noted.

I checked again. Its not working. The whole page is just blank.

Best Regards
Trishna

Sorry I didn’t see your reply earlier. looking more closely at your code it looks like you’re missing a couple things. Then again I am not sure what step you are stuck on, if I knew what step, it would be easier to pinpoint what went wrong.

however, here is what I did notice. compare my code block here to your own.

const getForecast = async () => {
  const urlToFetch = `${weatherUrl}?&q=${$input.val()}&APPID=${openWeatherKey}`
  try {
    const response = await 
    fetch(urlToFetch);
    if (response.ok) {
      const jsonResponse = await
      response.json();
      console.log(jsonResponse);
      return jsonResponse;
    }

  } catch(error) {
    console.log(error);
  }

}