Skip to content

Commit

Permalink
fix(用户信息): 修改用户信息存储方式
Browse files Browse the repository at this point in the history
修改存储获取方式
  • Loading branch information
Lind-pro committed Oct 10, 2020
1 parent 711d8a5 commit 65c6a0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/GlobalHeader/AvatarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = (props) => {
useEffect(() => {
service.get().subscribe((resp) => {
setUser(resp);
localStorage.setItem('user-detail', JSON.stringify(resp));
// localStorage.setItem('tenants-admin', resp.tenants[0]?.adminMember);
})
}, [currentUser]);
Expand Down
2 changes: 1 addition & 1 deletion src/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const UserModel: UserModelType = {
tempLogin.permissions = response.result.permissions;
localStorage.setItem('hsweb-autz', JSON.stringify(tempLogin));
} else {
// localStorage.setItem('hsweb-autz', JSON.stringify(response.result));
localStorage.setItem('hsweb-autz', JSON.stringify(response.result));
}
yield put({
type: 'saveCurrentUser',
Expand Down
8 changes: 3 additions & 5 deletions src/pages/analysis/components/Tenant/TenantDevice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,9 @@ const TenantDevice: React.FC<Props> = (props) => {
const service = new Service('');
const [data, setData] = useState<any[]>([]);

const user = JSON.parse(localStorage.getItem('hsweb-autz') || '{}');

const tenantId = user?.user.tenants.filter((i: any) => i.mainTenant)[0]?.tenantId;
const userId = user?.userId;
const tenantAdmin = user?.user.tenants.filter((i: any) => i.mainTenant)[0]?.adminMember;
const user = JSON.parse(localStorage.getItem('user-detail') || '{}');
const tenantId = (user.tenants || []).filter((i: any) => i.mainTenant)[0]?.tenantId;
const tenantAdmin = (user.tenants || []).filter((i: any) => i.mainTenant)[0]?.adminMember;

const getProduct = (userId: string) =>
service.assets.productNopaging(encodeQueryParam({
Expand Down

0 comments on commit 65c6a0f

Please sign in to comment.