Skip to content

Commit 1e3a083

Browse files
committed
🔧 release
1 parent a884cbc commit 1e3a083

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

js/github.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,6 @@
33
// Copyright (c) 2022 Seyon Rajagopal
44
// -------------------------------------------
55

6-
async function latest_release(repo_name) {
7-
try {
8-
const response = await fetch('https://api.github.com/repos/qlibs/' + repo_name + '/releases');
9-
if (!response.ok) {
10-
console.error('Failed to fetch releases:', response.statusText);
11-
return '';
12-
}
13-
14-
const releases = await response.json();
15-
if (Array.isArray(releases) && releases.length > 0) {
16-
console.log(releases);
17-
return releases[0].tag_name || '';
18-
} else {
19-
return '';
20-
}
21-
} catch (error) {
22-
console.error('Error fetching release data:', error);
23-
return '';
24-
}
25-
}
26-
276
async function latest_release(repo_name) {
287
const response = await fetch(`https://api.github.com/repos/qlibs/${repo_name}/releases/latest`);
298
const data = await response.json();
@@ -50,10 +29,10 @@ window.onload = function () {
5029
latest_release(repo_name).then(repo_release => {
5130
$("#repo-box").append("<a href='" + repo_url + "'><div class='repo-item'><h1 class='title'>" +
5231
"" +
53-
repo_name + "</h1><div style='color:darkgray'> ("+ repo_release +")</div> <p class='description'>" +
32+
repo_name + "</h1> <div style='color:darkgray'> (" + repo_release + ") </div><p class='description'>" +
5433
repo_description +
55-
" <div class='star'><span class='img' uk-icon='star' class='uk-icon'></span>" +
56-
repo_stars + " </div> <div class='fork'><span class='img' uk-icon='git-fork' class='uk-icon'></span>" +
34+
"<div class='star'><span class='img' uk-icon='star' class='uk-icon'></span>" +
35+
repo_stars + "</div><div class='fork'><span class='img' uk-icon='git-fork' class='uk-icon'></span>" +
5736
repo_forks + "</div></div></div>" +
5837
"</p>"
5938
);

0 commit comments

Comments
 (0)