feat: latest code update
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user