✨ Unmocking office and admin
This commit is contained in:
parent
7960eae224
commit
e22cc9635b
@ -4,6 +4,7 @@ import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
|||||||
import Header from "@Front/Components/DesignSystem/Header";
|
import Header from "@Front/Components/DesignSystem/Header";
|
||||||
import Version from "@Front/Components/DesignSystem/Version";
|
import Version from "@Front/Components/DesignSystem/Version";
|
||||||
import BackArrow from "@Front/Components/Elements/BackArrow";
|
import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||||
|
import JwtService from "@Front/Services/JwtService/JwtService";
|
||||||
import WindowStore from "@Front/Stores/WindowStore";
|
import WindowStore from "@Front/Stores/WindowStore";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import User from "le-coffre-resources/dist/Notary";
|
import User from "le-coffre-resources/dist/Notary";
|
||||||
@ -87,8 +88,10 @@ export default class DefaultCollaboratorDashboard extends React.Component<IProps
|
|||||||
|
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
|
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
|
||||||
|
const jwt = JwtService.getInstance().decodeJwt();
|
||||||
|
if (!jwt) return;
|
||||||
const query: IGetUsersparams = {
|
const query: IGetUsersparams = {
|
||||||
where: { office_uid: "6981326f-8a0a-4437-b15c-4cd5c4d80f6e" },
|
where: { office_uid: jwt!.office_Id },
|
||||||
include: { contact: true },
|
include: { contact: true },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
|||||||
import Header from "@Front/Components/DesignSystem/Header";
|
import Header from "@Front/Components/DesignSystem/Header";
|
||||||
import Version from "@Front/Components/DesignSystem/Version";
|
import Version from "@Front/Components/DesignSystem/Version";
|
||||||
import BackArrow from "@Front/Components/Elements/BackArrow";
|
import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||||
|
import JwtService from "@Front/Services/JwtService/JwtService";
|
||||||
import WindowStore from "@Front/Stores/WindowStore";
|
import WindowStore from "@Front/Stores/WindowStore";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { DocumentType } from "le-coffre-resources/dist/Notary";
|
import { DocumentType } from "le-coffre-resources/dist/Notary";
|
||||||
@ -87,9 +88,11 @@ export default class DefaultDocumentTypesDashboard extends React.Component<IProp
|
|||||||
|
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
|
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
|
||||||
|
const jwt = JwtService.getInstance().decodeJwt();
|
||||||
|
if (!jwt) return;
|
||||||
const documentTypes = await DocumentTypes.getInstance().get({
|
const documentTypes = await DocumentTypes.getInstance().get({
|
||||||
where: {
|
where: {
|
||||||
office_uid: "6981326f-8a0a-4437-b15c-4cd5c4d80f6e",
|
office_uid: jwt.office_Id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.setState({ documentTypes });
|
this.setState({ documentTypes });
|
||||||
|
@ -6,6 +6,7 @@ import TextField from "@Front/Components/DesignSystem/Form/TextField";
|
|||||||
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
||||||
import DefaultDocumentTypesDashboard from "@Front/Components/LayoutTemplates/DefaultDocumentTypesDashboard";
|
import DefaultDocumentTypesDashboard from "@Front/Components/LayoutTemplates/DefaultDocumentTypesDashboard";
|
||||||
import Module from "@Front/Config/Module";
|
import Module from "@Front/Config/Module";
|
||||||
|
import JwtService from "@Front/Services/JwtService/JwtService";
|
||||||
import { validateOrReject, ValidationError } from "class-validator";
|
import { validateOrReject, ValidationError } from "class-validator";
|
||||||
import { DocumentType, Office } from "le-coffre-resources/dist/Admin";
|
import { DocumentType, Office } from "le-coffre-resources/dist/Admin";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
@ -21,10 +22,12 @@ export default function DocumentTypesCreate(props: IProps) {
|
|||||||
const onSubmitHandler = useCallback(
|
const onSubmitHandler = useCallback(
|
||||||
async (e: React.FormEvent<HTMLFormElement> | null, values: { [key: string]: string }) => {
|
async (e: React.FormEvent<HTMLFormElement> | null, values: { [key: string]: string }) => {
|
||||||
try {
|
try {
|
||||||
|
const jwt = JwtService.getInstance().decodeJwt();
|
||||||
|
if (!jwt) return;
|
||||||
const documentToCreate = DocumentType.hydrate<DocumentType>({
|
const documentToCreate = DocumentType.hydrate<DocumentType>({
|
||||||
...values,
|
...values,
|
||||||
office: Office.hydrate<Office>({
|
office: Office.hydrate<Office>({
|
||||||
uid: "6981326f-8a0a-4437-b15c-4cd5c4d80f6e",
|
uid: jwt.office_Id,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
await validateOrReject(documentToCreate, { groups: ["createDocumentType"] });
|
await validateOrReject(documentToCreate, { groups: ["createDocumentType"] });
|
||||||
|
@ -36,7 +36,7 @@ export default class LoginClass extends BasePage {
|
|||||||
// const variables = FrontendVariables.getInstance();
|
// const variables = FrontendVariables.getInstance();
|
||||||
// const baseFronturl = variables.BACK_API_PROTOCOL + variables.FRONT_APP_HOST;
|
// 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();
|
// await JwtService.getInstance().checkJwt();
|
||||||
// window.location.assign("http://localhost:3000" + "/folders");
|
// window.location.assign("http://localhost:3000" + "/folders");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user