Merge branch 'master' of https://codefirst.iut.uca.fr/git/JavaScript-TP_note/Projet-note
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in new issue