Skip to content

Commit 2460f66

Browse files
authoredSep 21, 2023
fix: add last updated time (doocs#1657)
1 parent 8d36843 commit 2460f66

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎index.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@
140140
const seconds = String(date.getSeconds()).padStart(2, '0');
141141
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
142142
}
143-
const file = vm.route.file
144-
const lastIndex = file.lastIndexOf("/");
145-
const filePath = vm.route.path === '/' ? '/README.md' : file.substring(0, lastIndex);
146-
const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${filePath}`;
143+
const { file } = vm.route
144+
const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${file}`;
147145
fetch(apiUrl, { method: 'GET' }).then(response => response.json())
148146
.then(data => {
149147
const date = data[0].commit.committer.date

0 commit comments

Comments
 (0)
Please sign in to comment.