diff --git a/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx index c2492910..0ce3a812 100644 --- a/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultCollaboratorDashboard/index.tsx @@ -4,6 +4,7 @@ import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import Header from "@Front/Components/DesignSystem/Header"; import Version from "@Front/Components/DesignSystem/Version"; import BackArrow from "@Front/Components/Elements/BackArrow"; +import JwtService from "@Front/Services/JwtService/JwtService"; import WindowStore from "@Front/Stores/WindowStore"; import classNames from "classnames"; import User from "le-coffre-resources/dist/Notary"; @@ -87,8 +88,10 @@ export default class DefaultCollaboratorDashboard extends React.Component this.onResize(window)); + const jwt = JwtService.getInstance().decodeJwt(); + if (!jwt) return; const query: IGetUsersparams = { - where: { office_uid: "6981326f-8a0a-4437-b15c-4cd5c4d80f6e" }, + where: { office_uid: jwt!.office_Id }, include: { contact: true }, }; diff --git a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx index e9cf5c3c..7616bf7a 100644 --- a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/index.tsx @@ -4,6 +4,7 @@ import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import Header from "@Front/Components/DesignSystem/Header"; import Version from "@Front/Components/DesignSystem/Version"; import BackArrow from "@Front/Components/Elements/BackArrow"; +import JwtService from "@Front/Services/JwtService/JwtService"; import WindowStore from "@Front/Stores/WindowStore"; import classNames from "classnames"; import { DocumentType } from "le-coffre-resources/dist/Notary"; @@ -87,9 +88,11 @@ export default class DefaultDocumentTypesDashboard extends React.Component this.onResize(window)); + const jwt = JwtService.getInstance().decodeJwt(); + if (!jwt) return; const documentTypes = await DocumentTypes.getInstance().get({ where: { - office_uid: "6981326f-8a0a-4437-b15c-4cd5c4d80f6e", + office_uid: jwt.office_Id, }, }); this.setState({ documentTypes }); diff --git a/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx b/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx index 90bbd6d6..2793df38 100644 --- a/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx +++ b/src/front/Components/Layouts/DocumentTypes/DocumentTypesCreate/index.tsx @@ -6,6 +6,7 @@ import TextField from "@Front/Components/DesignSystem/Form/TextField"; import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import DefaultDocumentTypesDashboard from "@Front/Components/LayoutTemplates/DefaultDocumentTypesDashboard"; import Module from "@Front/Config/Module"; +import JwtService from "@Front/Services/JwtService/JwtService"; import { validateOrReject, ValidationError } from "class-validator"; import { DocumentType, Office } from "le-coffre-resources/dist/Admin"; import { useRouter } from "next/router"; @@ -21,10 +22,12 @@ 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; const documentToCreate = DocumentType.hydrate({ ...values, office: Office.hydrate({ - uid: "6981326f-8a0a-4437-b15c-4cd5c4d80f6e", + uid: jwt.office_Id, }), }); await validateOrReject(documentToCreate, { groups: ["createDocumentType"] }); diff --git a/src/front/Components/Layouts/Login/index.tsx b/src/front/Components/Layouts/Login/index.tsx index 6f06055a..59da4eb7 100644 --- a/src/front/Components/Layouts/Login/index.tsx +++ b/src/front/Components/Layouts/Login/index.tsx @@ -36,7 +36,7 @@ export default class LoginClass extends BasePage { // const variables = FrontendVariables.getInstance(); // const baseFronturl = variables.BACK_API_PROTOCOL + variables.FRONT_APP_HOST; - await UserStore.instance.connect("SbRKyM8BJI"); + await UserStore.instance.connect(process.env["NEXT_PUBLIC_ADMIN_ID"] as string); // await JwtService.getInstance().checkJwt(); // window.location.assign("http://localhost:3000" + "/folders");