From 37d35f57f9f71d6d46ba6fd9f6156a4e39e4b6b9 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Fri, 29 Sep 2023 23:20:05 +0200 Subject: [PATCH] refacto role call to api --- .../Components/Layouts/Users/UserInformations/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/front/Components/Layouts/Users/UserInformations/index.tsx b/src/front/Components/Layouts/Users/UserInformations/index.tsx index f38761f9..08c59981 100644 --- a/src/front/Components/Layouts/Users/UserInformations/index.tsx +++ b/src/front/Components/Layouts/Users/UserInformations/index.tsx @@ -1,5 +1,5 @@ import WarningIcon from "@Assets/images/warning.png"; -import OfficeRoles from "@Front/Api/LeCoffreApi/Admin/OfficeRoles/OfficeRoles"; +//import OfficeRoles from "@Front/Api/LeCoffreApi/Admin/OfficeRoles/OfficeRoles"; import Roles from "@Front/Api/LeCoffreApi/Admin/Roles/Roles"; import LiveVotes from "@Front/Api/LeCoffreApi/SuperAdmin/LiveVotes/LiveVotes"; import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users"; @@ -69,9 +69,11 @@ export default function UserInformations(props: IProps) { }, }); if (!user) return; - const roles = await OfficeRoles.getInstance().get(); + const roles = await Roles.getInstance().get({ + where: {NOT: {OR:[{name: "super-admin"}, {name: "admin"}]}}, + }); if (!roles) return; - setAvailableRoles(roles.map((role) => ({ value: role.uid, label: role.name }))); + setAvailableRoles(roles.map((role) => ({ value: role.uid, label: role.label }))); setUserSelected(user); }, [userUid]);