fix: analysis.html 添加用户昵称显示
- checkAuth 中添加 .textContent 设置 - 分析页面导航栏现在显示用户昵称
This commit is contained in:
@@ -149,6 +149,7 @@ async function checkAuth(){
|
|||||||
const res=await apiFetch('/auth/profile');
|
const res=await apiFetch('/auth/profile');
|
||||||
if(!res||!res.ok){window.location.href='/';return false;}
|
if(!res||!res.ok){window.location.href='/';return false;}
|
||||||
currentUser=await res.json();
|
currentUser=await res.json();
|
||||||
|
$('userInfo').textContent=currentUser.nickname||currentUser.account;
|
||||||
if(currentUser.role==='admin')$('adminLink').style.display='';
|
if(currentUser.role==='admin')$('adminLink').style.display='';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user