feat: 添加前端单点登录

This commit is contained in:
xiaoxian521
2022-11-21 16:22:17 +08:00
parent 9b62d6ef1e
commit b10c3eb1bb
6 changed files with 79 additions and 17 deletions

View File

@@ -59,8 +59,10 @@ export function setToken(data: DataInfo<Date>) {
const { username, roles } = data;
setSessionKey(username, roles);
} else {
const { username, roles } =
storageSession.getItem<DataInfo<number>>(sessionKey);
const username =
storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "";
const roles =
storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
setSessionKey(username, roles);
}
}