From 6efaec70cf31da285c4d495962e5a4f34c779a5e Mon Sep 17 00:00:00 2001 From: yanglbme Date: Thu, 21 Sep 2023 15:47:32 +0800 Subject: [PATCH] fix: add last updated time --- index.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index ed29ec2037c71..82bcbfb7edddb 100644 --- a/index.html +++ b/index.html @@ -140,10 +140,8 @@ const seconds = String(date.getSeconds()).padStart(2, '0'); return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; } - const file = vm.route.file - const lastIndex = file.lastIndexOf("/"); - const filePath = vm.route.path === '/' ? '/README.md' : file.substring(0, lastIndex); - const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${filePath}`; + const { file } = vm.route + const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${file}`; fetch(apiUrl, { method: 'GET' }).then(response => response.json()) .then(data => { const date = data[0].commit.committer.date