- added new role;
- added logic of statuses for amendment;
This commit is contained in:
@@ -24,7 +24,7 @@ import DraftApplicationsTable from '../Dashboard/components/DraftApplicationsTab
|
||||
const Domande = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false);
|
||||
const [roleId, setRoleId] = useState(0);
|
||||
const [roleIds, setRoleIds] = useState([]);
|
||||
const [users, setUsers] = useState([]);
|
||||
const [chosenUser, setChosenUser] = useState(0);
|
||||
const [chosenApplication, setChosenApplication] = useState(0);
|
||||
@@ -34,10 +34,8 @@ const Domande = () => {
|
||||
const getRolesCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
const roles = data.data
|
||||
.filter(o => ['ROLE_PRE_INSTRUCTOR'].includes(o.roleType));
|
||||
if (roles.length) {
|
||||
setRoleId(roles[0].id);
|
||||
}
|
||||
.filter(o => ['ROLE_PRE_INSTRUCTOR', 'ROLE_INSTRUCTOR_MANAGER'].includes(o.roleType));
|
||||
setRoleIds(roles.map(o => o.id));
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -126,11 +124,11 @@ const Domande = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (roleId !== 0) {
|
||||
if (roleIds.length > 0) {
|
||||
setLoading(true);
|
||||
UserService.getUsers(getUsersCallback, errGetUsersCallback, [['roleId', roleId]])
|
||||
UserService.getUsers(getUsersCallback, errGetUsersCallback, [['roleIds', roleIds]])
|
||||
}
|
||||
}, [roleId]);
|
||||
}, [roleIds]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isVisibleEditDialog) {
|
||||
|
||||
Reference in New Issue
Block a user