"backend/vscode:/vscode.git/clone" did not exist on "3ee6f085db25ae699f1c81e0ca0906eeea6d9fd2"
Unverified Commit 523fa9f7 authored by IanShaw's avatar IanShaw Committed by GitHub
Browse files

fix(frontend): 修复用户仪表板日期格式错误导致请求失败 (#55)

修复 loadRecentUsage 函数中日期格式问题,将 ISO 完整格式改为 YYYY-MM-DD 格式,与后端 API 期望一致。
parent 54636781
...@@ -987,8 +987,8 @@ const loadChartData = async () => { ...@@ -987,8 +987,8 @@ const loadChartData = async () => {
const loadRecentUsage = async () => { const loadRecentUsage = async () => {
loadingUsage.value = true loadingUsage.value = true
try { try {
const endDate = new Date().toISOString() const endDate = new Date().toISOString().split('T')[0]
const startDate = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString() const startDate = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]
const usageResponse = await usageAPI.getByDateRange(startDate, endDate) const usageResponse = await usageAPI.getByDateRange(startDate, endDate)
recentUsage.value = usageResponse.items.slice(0, 5) recentUsage.value = usageResponse.items.slice(0, 5)
} catch (error) { } catch (error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment