From a3cb04efe724b68f49aac532f43d92e9377b8331 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 2 Nov 2023 10:35:39 +0100 Subject: [PATCH] added loading to roles --- src/Pages/AdminArea/Roles/index.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Pages/AdminArea/Roles/index.js b/src/Pages/AdminArea/Roles/index.js index dbc0d99..5945627 100644 --- a/src/Pages/AdminArea/Roles/index.js +++ b/src/Pages/AdminArea/Roles/index.js @@ -6,6 +6,7 @@ import { Input, Popconfirm, Space, + Spin, Tag, Tooltip, Tree, @@ -45,6 +46,7 @@ export default function AdminAreaRoles() { const adminAreaRolesContext = useAdminAreaRolesContext(); const [notificationApi, notificationContextHolder] = notification.useNotification(); + const [isLoading, setIsLoading] = useState(true); function createTreeDataList(permissions) { const result = []; @@ -123,12 +125,17 @@ export default function AdminAreaRoles() { ); useEffect(() => { - const rolesRequest = () => + const rolesRequest = () => { + setIsLoading(true); + myFetch("/adminarea/roles", "GET").then((data) => { adminAreaRolesContext.setRoles(data.Roles); adminAreaRolesContext.setRolesPermissions(data.RolesPermissions); adminAreaRolesContext.setUsers(data.Users); + + setIsLoading(false); }); + }; rolesRequest(); @@ -143,6 +150,24 @@ export default function AdminAreaRoles() { ); }, []); + if (isLoading) { + return ( +
+ +
+ ); + } + return ( {notificationContextHolder}