feat: choose is has local token

master
guofei 2024-06-13 22:41:32 +08:00
parent e390968b50
commit 5a885942f2
1 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,11 @@ export function render(oldRender: any) {
}
export async function getInitialState(): Promise<LoginAPI.LoginUserInfo | null> {
const token = localStorage.getItem('Authorization');
if (!token) {
history.replace('/login');
return {};
}
const { data: userInfo }: { data: LoginAPI.LoginUserInfo } = await getSupderInfoApi();
if (!userInfo) {
history.replace('/login');