refactor(webapp): invite and user form with new blueprintjs-formik components

This commit is contained in:
a.bouhuolia
2023-04-14 03:48:43 +02:00
parent cc863f774a
commit e9fdffa9d9
7 changed files with 70 additions and 37 deletions

View File

@@ -22,6 +22,14 @@ function UsersDataTable({
// #withAlertActions
openAlert,
}) {
const { mutateAsync: resendInviation } = useResendInvitation();
// Users list columns.
const columns = useUsersListColumns();
// Users list context.
const { users, isUsersLoading, isUsersFetching } = useUsersListContext();
// Handle edit user action.
const handleEditUserAction = useCallback(
(user) => {
@@ -50,9 +58,6 @@ function UsersDataTable({
},
[openAlert],
);
const { mutateAsync: resendInviation } = useResendInvitation();
const handleResendInvitation = useCallback((user) => {
resendInviation(user.id)
.then(() => {
@@ -71,17 +76,12 @@ function UsersDataTable({
AppToaster.show({
message:
'This person was recently invited. No need to invite them again just yet.',
intent: Intent.DANGER,
intent: Intent.WARNING,
});
}
},
);
});
// Users list columns.
const columns = useUsersListColumns();
// Users list context.
const { users, isUsersLoading, isUsersFetching } = useUsersListContext();
return (
<DataTable

View File

@@ -132,15 +132,9 @@ export const useUsersListColumns = () => {
{
id: 'role_name',
Header: intl.get('users.column.role_name'),
accessor: 'role.name',
accessor: 'role_name',
width: 120,
},
// {
// id: 'phone_number',
// Header: intl.get('phone_number'),
// accessor: 'phone_number',
// width: 120,
// },
{
id: 'status',
Header: intl.get('status'),