-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathligue.js
27 lines (24 loc) · 1.04 KB
/
ligue.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
async function fetchLigue() {
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': '7d8216ebb0msh38b7f2a7fe4e9f4p1e8b2ajsn7bc8bf122288',
'X-RapidAPI-Host': 'sports-live-scores.p.rapidapi.com'
}
};
const res = await fetch('https://sports-live-scores.p.rapidapi.com/football/rankings/4', options)
const record = await res.json()
document.getElementById("liguerank").innerHTML = record.rankings.map(item =>
{
if (item.Rank < 5) {
return `<li id="blue">${item['Team Name']} - ${item.Points} Points \xa0 <i>(${item.Matches} matches)</i></li>`
} else if (item.Rank > 17) {
return `<li id="red">${item['Team Name']} - ${item.Points} Points \xa0 <i>(${item.Matches} matches)</i></li>`
}
else {
return `<li>${item['Team Name']} - ${item.Points} Points \xa0 <i>(${item.Matches} matches)</i></li>`
}
}).join(' ');
console.log(record)
}
fetchLigue();