feat: choose is has local token
parent
e390968b50
commit
5a885942f2
|
@ -15,6 +15,11 @@ export function render(oldRender: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getInitialState(): Promise<LoginAPI.LoginUserInfo | null> {
|
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();
|
const { data: userInfo }: { data: LoginAPI.LoginUserInfo } = await getSupderInfoApi();
|
||||||
if (!userInfo) {
|
if (!userInfo) {
|
||||||
history.replace('/login');
|
history.replace('/login');
|
||||||
|
|
Loading…
Reference in New Issue