feat: latest code update

This commit is contained in:
yuzhiran
2026-06-16 13:18:36 +08:00
parent 5a49d15696
commit 96c367e0f8
17 changed files with 198 additions and 107 deletions
+12
View File
@@ -99,6 +99,18 @@ const refreshState = () => {
try { const s = uni.getStorageSync('userInfo'); if (s) userInfo.value = JSON.parse(s) } catch(e) {}
loadStats()
checkAdmin()
// Fetch fresh user info from API to update stale cache (e.g. credits changed after interview)
fetchUserInfo()
}
const fetchUserInfo = async () => {
try {
const res = await uni.request({ url: api('/user/info'), method: 'GET', header: { 'Authorization': `Bearer ${token.value}` } })
if (res.statusCode === 200 && res.data) {
userInfo.value = res.data
uni.setStorageSync('userInfo', JSON.stringify(res.data))
}
} catch(e) { /* silent - cached data is fallback */ }
}
onMounted(refreshState)