refactor: 前端登录/权限/界面状态迁移至 zustand
This commit is contained in:
@@ -28,9 +28,16 @@ export const buildTeacherCandidateLabel = (user: TeacherCandidateUser) => {
|
||||
displayName && displayName !== user.username
|
||||
? `${displayName}(${user.username})`
|
||||
: user.username;
|
||||
const roleNames = [...new Set((user.roles || []).map((role) => role.name).filter(Boolean))];
|
||||
const roleNames = [
|
||||
...new Set((user.roles || []).flatMap((role) => (role.name ? [role.name] : []))),
|
||||
];
|
||||
const subjects = [
|
||||
...new Set((user.profile?.subjects || []).map((subject) => subject.trim()).filter(Boolean)),
|
||||
...new Set(
|
||||
(user.profile?.subjects || []).flatMap((subject) => {
|
||||
const trimmed = subject.trim();
|
||||
return trimmed ? [trimmed] : [];
|
||||
}),
|
||||
),
|
||||
];
|
||||
|
||||
return [identity, roleNames.join('/'), subjects.join('/')].filter(Boolean).join(' · ');
|
||||
|
||||
Reference in New Issue
Block a user