S
S
Stepan2019-03-25 08:42:16
JavaScript
Stepan, 2019-03-25 08:42:16

Can't print data from the Yandex.Weather server?

Can't print data from the Yandex.Weather server?
Yandex has poor documentation + I have little experience to figure it out myself.
Please help me if I'm accessing the API correctly, if it's correct why it doesn't print out json.

getWeather(){
  return new Promise((resolve,reject) => {
    fetch(this.uri,{
      method: 'GET',
      headers: {
        'Content-type': 'application/json',
        'X-Yandex-API-Key': this.apiKey
      }
    })
.then(res => res.json()) // <--- Ошибка?
.then(data => resolve(data))
.catch(err => reject(err));
  });
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question