Bastien JACQUELIN 1 year ago
commit d544873864

@ -1,19 +1,15 @@
class NewsService{
constructor(){}
async getNews()
{
async getNews(){
const url = "https://newsapi.org/v2/everything?q=esport&apiKey=1639059dc5a942089bd2d29db40ee7e7";
const api = new ApiService()
let response = api.get(url);
console.log("JE SUIS LA PROMISE")
let tab = []
response.then((value)=>{
console.log(value)
for (let i = 0; i < 5; i++) {
tab.push(value[i]);
}
})
return tab
for (let i = 0; i < 5; i++) {
tab.push(response[i]);
}
return tab;
}
}

@ -30,6 +30,7 @@ export default{
console.log(this.news);
this.homeClicked=true;
this.teamClicked=false;
this.news = api.getNews();
}
else{
this.homeClicked=false;

Loading…
Cancel
Save