added loading to roles
parent
f045c1b328
commit
a3cb04efe7
|
@ -6,6 +6,7 @@ import {
|
||||||
Input,
|
Input,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
Space,
|
Space,
|
||||||
|
Spin,
|
||||||
Tag,
|
Tag,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Tree,
|
Tree,
|
||||||
|
@ -45,6 +46,7 @@ export default function AdminAreaRoles() {
|
||||||
const adminAreaRolesContext = useAdminAreaRolesContext();
|
const adminAreaRolesContext = useAdminAreaRolesContext();
|
||||||
const [notificationApi, notificationContextHolder] =
|
const [notificationApi, notificationContextHolder] =
|
||||||
notification.useNotification();
|
notification.useNotification();
|
||||||
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
function createTreeDataList(permissions) {
|
function createTreeDataList(permissions) {
|
||||||
const result = [];
|
const result = [];
|
||||||
|
@ -123,12 +125,17 @@ export default function AdminAreaRoles() {
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const rolesRequest = () =>
|
const rolesRequest = () => {
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
myFetch("/adminarea/roles", "GET").then((data) => {
|
myFetch("/adminarea/roles", "GET").then((data) => {
|
||||||
adminAreaRolesContext.setRoles(data.Roles);
|
adminAreaRolesContext.setRoles(data.Roles);
|
||||||
adminAreaRolesContext.setRolesPermissions(data.RolesPermissions);
|
adminAreaRolesContext.setRolesPermissions(data.RolesPermissions);
|
||||||
adminAreaRolesContext.setUsers(data.Users);
|
adminAreaRolesContext.setUsers(data.Users);
|
||||||
|
|
||||||
|
setIsLoading(false);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
rolesRequest();
|
rolesRequest();
|
||||||
|
|
||||||
|
@ -143,6 +150,24 @@ export default function AdminAreaRoles() {
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
textAlign: "center",
|
||||||
|
height: "98.3vh",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Spin size="large" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<Space direction="vertical" style={{ width: "100%" }}>
|
||||||
{notificationContextHolder}
|
{notificationContextHolder}
|
||||||
|
|
Loading…
Reference in New Issue