Refactor: Use const instead of let for immutable variables (Make LSP happy)

This commit is contained in:
lifeadventurer
2024-10-12 00:27:15 +08:00
parent bd00a3b72d
commit 32e3b5b9a3
6 changed files with 37 additions and 37 deletions

View File

@@ -14,14 +14,14 @@ async function get_generator_card_footer() {
const repoOwner = 'LifeAdventurer';
const repoName = 'generators';
for (let folderIndex = 1; folderIndex <= folderPaths.length; folderIndex++) {
let folderPath = folderPaths[folderIndex - 1];
const folderPath = folderPaths[folderIndex - 1];
const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/commits?path=${folderPath}`;
fetch(apiUrl)
.then(response => response.json())
.then(data => {
// the latest commit will be at the top of the list
let lastCommit = data[0].commit.author.date;
const lastCommit = data[0].commit.author.date;
const commitTimeStamp = new Date(lastCommit).getTime() / 1000;
const currentTimeStamp = Math.floor(new Date().getTime() / 1000);
const timeDifference = currentTimeStamp - commitTimeStamp;
@@ -51,9 +51,9 @@ function format_time_difference(seconds) {
get_generator_card_footer()
let darkModeIcon = document.querySelector('#dark-mode-icon');
const darkModeIcon = document.querySelector('#dark-mode-icon');
darkModeIcon.onclick = () => {
darkModeIcon.classList.toggle('bx-sun');
document.body.classList.toggle('dark-mode');
};
};