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