diff --git a/js/app.js b/js/app.js index 39928ae..60ef923 100644 --- a/js/app.js +++ b/js/app.js @@ -131,8 +131,9 @@ async function fetchcontributors() { const response = await fetch('https://api.samidy.com/api/contributors'); if (!response.ok) return; const data1 = await response.json(); + if (!Array.isArray(data1)) return; - const data = data1.filter( + let data = data1.filter( (user) => user.type !== 'Bot' && user.login !== 'edidealt' && user.login !== 'satanyahoo' ); @@ -142,6 +143,8 @@ async function fetchcontributors() { edideaur.contributions += data1.find((u) => u.login === 'satanyahoo')?.contributions || 0; } + data.sort((a, b) => b.contributions - a.contributions); + const con = document.querySelector('.about-contributors'); if (!con) return; @@ -158,6 +161,7 @@ async function fetchcontributors() { }); } catch (e) { const con = document.querySelector('.about-contributors-failed'); + if (!con) return; const userDIV = document.createElement('div'); userDIV.innerHTML = `