Loaders and delete user confirmation

This commit is contained in:
Valentino Kozinec 2022-02-11 12:45:22 +01:00
parent 9f734ec474
commit f034706bbb
10 changed files with 240 additions and 152 deletions

View file

@ -1,12 +1,13 @@
import { useDispatch, useSelector } from 'react-redux';
import { getUsers, fetchUsers, fetchUserById, updateUserById, createUser, deleteUser } from '../redux';
import { getUserById, getUserModalLoading } from '../redux/selectors';
import { getUserById, getUserModalLoading, getUserslLoading } from '../redux/selectors';
export function useUsers() {
const dispatch = useDispatch();
const users = useSelector(getUsers);
const user = useSelector(getUserById);
const userModalLoading = useSelector(getUserModalLoading);
const userTableLoading = useSelector(getUserslLoading);
function loadUsers() {
return dispatch(fetchUsers());
@ -35,6 +36,7 @@ export function useUsers() {
loadUsers,
editUserById,
userModalLoading,
userTableLoading,
createNewUser,
deleteUserById,
};