diff --git a/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx index cc6db955..e1b286b4 100644 --- a/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx @@ -36,14 +36,14 @@ export default function DefaultCollaboratorDashboard(props: IProps) { */ const user: any = UserStore.instance.getUser(); - const officeUid: string = user.office.uid; + const officeId: string = user.office.uid; CollaboratorService.getCollaborators().then((processes: any[]) => { if (processes.length > 0) { let collaborators: any[] = processes.map((process: any) => process.processData); // FilterBy office.uid - collaborators = collaborators.filter((collaborator: any) => collaborator.office.uid === officeUid); + collaborators = collaborators.filter((collaborator: any) => collaborator.office.uid === officeId); setCollaborators(collaborators); } diff --git a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx index de28f865..3a04273e 100644 --- a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx @@ -7,6 +7,7 @@ import JwtService from "@Front/Services/JwtService/JwtService"; import { DocumentType } from "le-coffre-resources/dist/Notary"; import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService"; +import UserStore from "@Front/Stores/UserStore"; type IProps = IPropsDashboardWithList; @@ -15,11 +16,8 @@ export default function DefaultDocumentTypeDashboard(props: IProps) { const router = useRouter(); const { documentTypeUid } = router.query; useEffect(() => { - const jwt = JwtService.getInstance().decodeJwt(); - if (!jwt) return; - - // TODO: review - const officeId = 'demo_notary_office_id'; // jwt.office_Id; + const user: any = UserStore.instance.getUser(); + const officeId: string = user.office.uid; DocumentTypeService.getDocumentTypes().then((processes: any[]) => { if (processes.length > 0) { diff --git a/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx b/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx index 1a8d38ce..0e53c8d3 100644 --- a/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx +++ b/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx @@ -16,6 +16,7 @@ import classes from "./classes.module.scss"; import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService"; import LoaderService from "src/common/Api/LeCoffreApi/sdk/Loader/LoaderService"; +import UserStore from "@Front/Stores/UserStore"; type IProps = {}; export default function DocumentTypesCreate(props: IProps) { @@ -25,11 +26,8 @@ export default function DocumentTypesCreate(props: IProps) { const onSubmitHandler = useCallback( async (e: React.FormEvent | null, values: { [key: string]: string }) => { try { - const jwt = JwtService.getInstance().decodeJwt(); - if (!jwt) return; - - // TODO: review - const officeId = 'demo_notary_office_id'; // jwt.office_Id; + const user: any = UserStore.instance.getUser(); + const officeId: string = user.office.uid; const documentFormModel = DocumentType.hydrate({ ...values, diff --git a/src/front/Components/Layouts/Roles/RolesCreate/index.tsx b/src/front/Components/Layouts/Roles/RolesCreate/index.tsx index 7a7694ea..a6d7cee0 100644 --- a/src/front/Components/Layouts/Roles/RolesCreate/index.tsx +++ b/src/front/Components/Layouts/Roles/RolesCreate/index.tsx @@ -19,6 +19,7 @@ import { ValidationError } from "class-validator"; import RoleService from "src/common/Api/LeCoffreApi/sdk/RoleService"; import LoaderService from "src/common/Api/LeCoffreApi/sdk/Loader/LoaderService"; +import UserStore from "@Front/Stores/UserStore"; type IProps = {}; export default function RolesCreate(props: IProps) { @@ -29,10 +30,8 @@ export default function RolesCreate(props: IProps) { const router = useRouter(); const onSubmitHandler = useCallback( async (e: React.FormEvent | null, values: { [key: string]: string }) => { - const jwt = JwtService.getInstance().decodeJwt(); - - // TODO: review - const officeId = 'demo_notary_office_id'; //jwt?.office_Id; + const user: any = UserStore.instance.getUser(); + const officeId: string = user.office.uid; const officeRole = OfficeRole.hydrate({ name: values["name"],