Fix some bugs
This commit is contained in:
parent
7435a33fe0
commit
5ad6465b74
@ -3,7 +3,8 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import MessageBus from 'src/sdk/MessageBus';
|
||||
import User from 'src/sdk/User';
|
||||
import DocumentService from './DocumentService';
|
||||
|
||||
import DocumentTypeService from './DocumentTypeService';
|
||||
|
||||
export default class DeedTypeService {
|
||||
|
||||
@ -92,11 +93,13 @@ export default class DeedTypeService {
|
||||
|
||||
if (includeDocumentTypes && process.processData.document_types && process.processData.document_types.length > 0) {
|
||||
process.processData.document_types = await new Promise<any[]>(async (resolve: (document_types: any[]) => void) => {
|
||||
const document_types: any[] = [];
|
||||
let document_types: any[] = [];
|
||||
for (const document_type of process.processData.document_types) {
|
||||
const p: any = await DocumentService.getDocumentByUid(document_type.uid);
|
||||
const p: any = await DocumentTypeService.getDocumentTypeByUid(document_type.uid);
|
||||
document_types.push(p.processData);
|
||||
}
|
||||
// Remove duplicates
|
||||
document_types = document_types.filter((item: any, index: number) => document_types.findIndex((t: any) => t.uid === item.uid) === index);
|
||||
resolve(document_types);
|
||||
});
|
||||
}
|
||||
|
@ -92,4 +92,17 @@ export default class DocumentService {
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
public static updateDocument(process: any, newData: any): Promise<void> {
|
||||
return new Promise<void>((resolve: () => void, reject: (error: string) => void) => {
|
||||
this.messageBus.updateProcess(process.processId, newData, [], null).then((processUpdated: any) => {
|
||||
const newStateId: string = processUpdated.diffs[0]?.state_id;
|
||||
this.messageBus.notifyUpdate(process.processId, newStateId).then(() => {
|
||||
this.messageBus.validateState(process.processId, newStateId).then((_stateValidated) => {
|
||||
resolve();
|
||||
}).catch(reject);
|
||||
}).catch(reject);
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
108
src/common/Api/LeCoffreApi/sdk/DocumentTypeService.ts
Normal file
108
src/common/Api/LeCoffreApi/sdk/DocumentTypeService.ts
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import MessageBus from 'src/sdk/MessageBus';
|
||||
import User from 'src/sdk/User';
|
||||
|
||||
export default class DocumentTypeService {
|
||||
|
||||
private static readonly messageBus: MessageBus = MessageBus.getInstance();
|
||||
|
||||
private constructor() { }
|
||||
|
||||
public static createDocumentType(documentData: any, validatorId: string): Promise<any> {
|
||||
const ownerId = User.getInstance().getPairingId()!;
|
||||
|
||||
const processData: any = {
|
||||
uid: uuidv4(),
|
||||
utype: 'documentType',
|
||||
isDeleted: 'false',
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString(),
|
||||
...documentData,
|
||||
};
|
||||
|
||||
const privateFields: string[] = Object.keys(processData);
|
||||
privateFields.splice(privateFields.indexOf('uid'), 1);
|
||||
privateFields.splice(privateFields.indexOf('utype'), 1);
|
||||
|
||||
const roles: any = {
|
||||
demiurge: {
|
||||
members: [...[ownerId], validatorId],
|
||||
validation_rules: [],
|
||||
storages: []
|
||||
},
|
||||
owner: {
|
||||
members: [ownerId],
|
||||
validation_rules: [
|
||||
{
|
||||
quorum: 0.5,
|
||||
fields: [...privateFields, 'roles', 'uid', 'utype'],
|
||||
min_sig_member: 1,
|
||||
},
|
||||
],
|
||||
storages: []
|
||||
},
|
||||
validator: {
|
||||
members: [validatorId],
|
||||
validation_rules: [
|
||||
{
|
||||
quorum: 0.5,
|
||||
fields: ['idCertified', 'roles'],
|
||||
min_sig_member: 1,
|
||||
},
|
||||
{
|
||||
quorum: 0.0,
|
||||
fields: [...privateFields],
|
||||
min_sig_member: 0,
|
||||
},
|
||||
],
|
||||
storages: []
|
||||
},
|
||||
apophis: {
|
||||
members: [ownerId],
|
||||
validation_rules: [],
|
||||
storages: []
|
||||
}
|
||||
};
|
||||
|
||||
return new Promise<any>((resolve: (processCreated: any) => void, reject: (error: string) => void) => {
|
||||
this.messageBus.createProcess(processData, privateFields, roles).then((processCreated: any) => {
|
||||
this.messageBus.notifyUpdate(processCreated.processId, processCreated.process.states[0].state_id).then(() => {
|
||||
this.messageBus.validateState(processCreated.processId, processCreated.process.states[0].state_id).then((_stateValidated: any) => {
|
||||
resolve(processCreated);
|
||||
}).catch(reject);
|
||||
}).catch(reject);
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
public static getDocumentTypes(): Promise<any[]> {
|
||||
return this.messageBus.getProcessesDecoded((publicValues: any) => publicValues['uid'] && publicValues['utype'] && publicValues['utype'] === 'documentType');
|
||||
}
|
||||
|
||||
public static getDocumentTypeByUid(uid: string): Promise<any> {
|
||||
return new Promise<any>((resolve: (process: any) => void, reject: (error: string) => void) => {
|
||||
this.messageBus.getProcessesDecoded((publicValues: any) => publicValues['uid'] && publicValues['uid'] === uid && publicValues['utype'] && publicValues['utype'] === 'documentType').then((processes: any[]) => {
|
||||
if (processes.length === 0) {
|
||||
resolve(null);
|
||||
} else {
|
||||
resolve(processes[0]);
|
||||
}
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
public static updateDocumentType(process: any, newData: any): Promise<void> {
|
||||
return new Promise<void>((resolve: () => void, reject: (error: string) => void) => {
|
||||
this.messageBus.updateProcess(process.processId, newData, [], null).then((processUpdated: any) => {
|
||||
const newStateId: string = processUpdated.diffs[0]?.state_id;
|
||||
this.messageBus.notifyUpdate(process.processId, newStateId).then(() => {
|
||||
this.messageBus.validateState(process.processId, newStateId).then((_stateValidated) => {
|
||||
resolve();
|
||||
}).catch(reject);
|
||||
}).catch(reject);
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
}
|
@ -19,7 +19,6 @@ export default class FolderService {
|
||||
const processData: any = {
|
||||
uid: uuidv4(),
|
||||
utype: 'folder',
|
||||
isArchived: 'false',
|
||||
isDeleted: 'false',
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString(),
|
||||
@ -113,6 +112,7 @@ export default class FolderService {
|
||||
if (includeDeedType && process.processData.deed && process.processData.deed.deed_type) {
|
||||
const p: any = await DeedTypeService.getDeedTypeByUid(process.processData.deed.deed_type.uid);
|
||||
process.processData.deed.deed_type = p.processData;
|
||||
// Remove duplicates
|
||||
process.processData.deed.document_types = p.processData.document_types.filter((item: any, index: number) => p.processData.document_types.findIndex((t: any) => t.uid === item.uid) === index);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import DefaultDashboardWithList, { IPropsDashboardWithList } from "../DefaultDas
|
||||
import JwtService from "@Front/Services/JwtService/JwtService";
|
||||
import { DocumentType } from "le-coffre-resources/dist/Notary";
|
||||
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||
|
||||
type IProps = IPropsDashboardWithList;
|
||||
|
||||
@ -21,7 +21,7 @@ export default function DefaultDocumentTypeDashboard(props: IProps) {
|
||||
// TODO: review
|
||||
const officeId = 'demo_notary_office_id'; // jwt.office_Id;
|
||||
|
||||
DocumentService.getDocuments().then((processes: any[]) => {
|
||||
DocumentTypeService.getDocumentTypes().then((processes: any[]) => {
|
||||
if (processes.length > 0) {
|
||||
let documents: any[] = processes.map((process: any) => process.processData);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Folders, { IGetFoldersParams } from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
|
||||
import EFolderStatus from "le-coffre-resources/dist/Customer/EFolderStatus";
|
||||
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document";
|
||||
|
||||
import Module from "@Front/Config/Module";
|
||||
@ -76,9 +75,10 @@ export default function DefaultNotaryDashboard(props: IProps) {
|
||||
}, [folders, getBlocks]);
|
||||
|
||||
useEffect(() => {
|
||||
/* TODO: review
|
||||
let targetedStatus: EFolderStatus = EFolderStatus["LIVE" as keyof typeof EFolderStatus];
|
||||
if (isArchived) targetedStatus = EFolderStatus.ARCHIVED;
|
||||
|
||||
/* TODO: review
|
||||
const query: IGetFoldersParams = {
|
||||
q: {
|
||||
where: { status: targetedStatus },
|
||||
@ -117,8 +117,12 @@ export default function DefaultNotaryDashboard(props: IProps) {
|
||||
|
||||
FolderService.getFolders().then((processes: any[]) => {
|
||||
if (processes.length > 0) {
|
||||
const folders: any[] = processes.map((process: any) => process.processData);
|
||||
setFolders(folders.filter((folder: any) => folder.isArchived && folder.isArchived === (isArchived ? 'true' : 'false')));
|
||||
let folders: any[] = processes.map((process: any) => process.processData);
|
||||
|
||||
// FilterBy status
|
||||
folders = folders.filter((folder: any) => folder.status === targetedStatus);
|
||||
|
||||
setFolders(folders);
|
||||
}
|
||||
});
|
||||
}, [isArchived]);
|
||||
|
@ -20,7 +20,7 @@ import { useCallback, useEffect, useState } from "react";
|
||||
import classes from "./classes.module.scss";
|
||||
|
||||
import DeedTypeService from "src/common/Api/LeCoffreApi/sdk/DeedTypeService";
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||
|
||||
type IProps = {};
|
||||
export default function DeedTypesInformations(props: IProps) {
|
||||
@ -85,7 +85,7 @@ export default function DeedTypesInformations(props: IProps) {
|
||||
}
|
||||
|
||||
async function getDocuments() {
|
||||
DocumentService.getDocuments().then((processes: any[]) => {
|
||||
DocumentTypeService.getDocumentTypes().then((processes: any[]) => {
|
||||
if (processes.length) {
|
||||
const documents: any[] = processes.map((process: any) => process.processData);
|
||||
setAvailableDocuments(documents);
|
||||
@ -119,7 +119,7 @@ export default function DeedTypesInformations(props: IProps) {
|
||||
DeedTypeService.updateDeedType(process, { document_types: document_types }).then(() => {
|
||||
closeSaveModal();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}, [closeSaveModal, deedTypeUid, selectedDocuments]);
|
||||
|
@ -13,7 +13,7 @@ import { useCallback, useState } from "react";
|
||||
|
||||
import classes from "./classes.module.scss";
|
||||
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||
|
||||
type IProps = {};
|
||||
export default function DocumentTypesCreate(props: IProps) {
|
||||
@ -45,7 +45,7 @@ export default function DocumentTypesCreate(props: IProps) {
|
||||
};
|
||||
const validatorId: string = '884cb36a346a79af8697559f16940141f068bdf1656f88fa0df0e9ecd7311fb8:0';
|
||||
|
||||
DocumentService.createDocument(documentData, validatorId).then((processCreated: any) => {
|
||||
DocumentTypeService.createDocumentType(documentData, validatorId).then((processCreated: any) => {
|
||||
router.push(
|
||||
Module.getInstance()
|
||||
.get()
|
||||
|
@ -12,7 +12,7 @@ import { useEffect, useState } from "react";
|
||||
import classes from "./classes.module.scss";
|
||||
import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||
|
||||
export default function DocumentTypesInformations() {
|
||||
const router = useRouter();
|
||||
@ -24,7 +24,7 @@ export default function DocumentTypesInformations() {
|
||||
async function getDocument() {
|
||||
if (!documentTypeUid) return;
|
||||
|
||||
DocumentService.getDocumentByUid(documentTypeUid as string).then((process: any) => {
|
||||
DocumentTypeService.getDocumentTypeByUid(documentTypeUid as string).then((process: any) => {
|
||||
if (process) {
|
||||
const document: any = process.processData;
|
||||
setDocumentSelected(document);
|
||||
|
@ -12,7 +12,7 @@ import { ChangeEvent, useCallback, useEffect, useState } from "react";
|
||||
|
||||
import classes from "./classes.module.scss";
|
||||
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||
|
||||
type IProps = {
|
||||
isCreateDocumentModalVisible: boolean;
|
||||
@ -31,7 +31,7 @@ export default function ParameterDocuments(props: IProps) {
|
||||
const [formattedOptions, setFormattedOptions] = useState<IOption[]>([]);
|
||||
|
||||
const getAvailableDocuments = useCallback(async () => {
|
||||
DocumentService.getDocuments().then((processes: any[]) => {
|
||||
DocumentTypeService.getDocumentTypes().then((processes: any[]) => {
|
||||
if (processes.length > 0) {
|
||||
const documents: any[] = processes.map((process: any) => process.processData);
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Documents from "@Front/Api/LeCoffreApi/Notary/Documents/Documents";
|
||||
import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
|
||||
import Button, { EButtonSize, EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||
import CheckBox from "@Front/Components/DesignSystem/CheckBox";
|
||||
import Form from "@Front/Components/DesignSystem/Form";
|
||||
@ -8,6 +6,7 @@ import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||
import Module from "@Front/Config/Module";
|
||||
import { PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useCallback, useEffect, useState, useRef } from "react";
|
||||
import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage";
|
||||
@ -15,7 +14,9 @@ import classes from "./classes.module.scss";
|
||||
import ParameterDocuments from "./ParameterDocuments";
|
||||
import { IOption } from "@Front/Components/DesignSystem/Form/SelectFieldOld";
|
||||
import backgroundImage from "@Assets/images/background_refonte.svg";
|
||||
|
||||
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
|
||||
export default function AskDocuments() {
|
||||
const router = useRouter();
|
||||
@ -58,10 +59,9 @@ export default function AskDocuments() {
|
||||
try {
|
||||
// TODO: review
|
||||
const documentAsked: [] = values["document_types"] as [];
|
||||
|
||||
/*
|
||||
|
||||
for (let i = 0; i < documentAsked.length; i++) {
|
||||
await Documents.getInstance().post({
|
||||
const documentData: any = {
|
||||
folder: {
|
||||
uid: folderUid,
|
||||
},
|
||||
@ -69,9 +69,13 @@ export default function AskDocuments() {
|
||||
uid: customerUid,
|
||||
},
|
||||
document_type: {
|
||||
uid: documentAsked[i],
|
||||
uid: documentAsked[i]
|
||||
},
|
||||
});
|
||||
document_status: EDocumentStatus.ASKED
|
||||
};
|
||||
const validatorId: string = '884cb36a346a79af8697559f16940141f068bdf1656f88fa0df0e9ecd7311fb8:0';
|
||||
|
||||
await DocumentService.createDocument(documentData, validatorId);
|
||||
}
|
||||
|
||||
router.push(
|
||||
@ -79,7 +83,6 @@ export default function AskDocuments() {
|
||||
.get()
|
||||
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", folderUid as string),
|
||||
);
|
||||
*/
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
@ -124,25 +127,6 @@ export default function AskDocuments() {
|
||||
|
||||
const loadData = useCallback(async () => {
|
||||
try {
|
||||
/*
|
||||
const folder = await Folders.getInstance().getByUid(folderUid as string, {
|
||||
q: {
|
||||
deed: {
|
||||
include: {
|
||||
document_types: true,
|
||||
},
|
||||
},
|
||||
office: true,
|
||||
documents: {
|
||||
include: {
|
||||
depositor: true,
|
||||
document_type: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
FolderService.getFolderByUid(folderUid as string).then(async (process: any) => {
|
||||
if (process) {
|
||||
const folder: any = process.processData;
|
||||
@ -150,12 +134,6 @@ export default function AskDocuments() {
|
||||
setDocumentTypes(await getAvailableDocuments(folder));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
if (!folder) return;
|
||||
setFolder(folder);
|
||||
setDocumentTypes(await getAvailableDocuments(folder));
|
||||
*/
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import JwtService from "@Front/Services/JwtService/JwtService";
|
||||
import { ValidationError } from "class-validator/types/validation/ValidationError";
|
||||
import { Deed, Office, OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||
import User from "le-coffre-resources/dist/Notary";
|
||||
import EFolderStatus from "le-coffre-resources/dist/Customer/EFolderStatus";
|
||||
import { DeedType } from "le-coffre-resources/dist/Notary";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
@ -90,7 +91,8 @@ export default function CreateFolder(): JSX.Element {
|
||||
customers: [],
|
||||
documents: [],
|
||||
notes: [],
|
||||
stakeholders: folderAccessType === "whole_office" ? availableCollaborators : selectedCollaborators
|
||||
stakeholders: folderAccessType === "whole_office" ? availableCollaborators : selectedCollaborators,
|
||||
status: EFolderStatus.LIVE
|
||||
};
|
||||
|
||||
FolderService.createFolder(folderData, [], []).then((processCreated: any) => {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import Documents from "@Front/Api/LeCoffreApi/Notary/Documents/Documents";
|
||||
import DocumentsNotary from "@Front/Api/LeCoffreApi/Notary/DocumentsNotary/DocumentsNotary";
|
||||
import Files from "@Front/Api/LeCoffreApi/Notary/Files/Files";
|
||||
import FilesNotary from "@Front/Api/LeCoffreApi/Notary/FilesNotary/Files";
|
||||
@ -23,6 +22,9 @@ import classes from "./classes.module.scss";
|
||||
import DeleteAskedDocumentModal from "./DeleteAskedDocumentModal";
|
||||
import DeleteSentDocumentModal from "./DeleteSentDocumentModal";
|
||||
|
||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||
|
||||
type IProps = {
|
||||
customerUid: string;
|
||||
folderUid: string;
|
||||
@ -53,13 +55,31 @@ export default function DocumentTables(props: IProps) {
|
||||
|
||||
const fetchDocuments = useCallback(
|
||||
() =>
|
||||
DocumentService.getDocuments().then(async (processes: any[]) => {
|
||||
if (processes.length > 0) {
|
||||
let documents: any[] = processes.map((process: any) => process.processData);
|
||||
|
||||
// FilterBy folder.uid & depositor.uid
|
||||
documents = documents.filter((document: any) => document.folder.uid === folderUid && document.depositor.uid === customerUid);
|
||||
|
||||
for (const document of documents) {
|
||||
const documentTypeUid: string = document.document_type.uid;
|
||||
|
||||
const p: any = await DocumentTypeService.getDocumentTypeByUid(documentTypeUid);
|
||||
document.document_type = p.processData;
|
||||
}
|
||||
|
||||
setDocuments(documents);
|
||||
}
|
||||
})
|
||||
/*
|
||||
Documents.getInstance()
|
||||
.get({
|
||||
where: { folder: { uid: folderUid }, depositor: { uid: customerUid } },
|
||||
include: { files: true, document_type: true },
|
||||
})
|
||||
.then(setDocuments)
|
||||
.catch(console.warn),
|
||||
.catch(console.warn)*/,
|
||||
[customerUid, folderUid],
|
||||
);
|
||||
|
||||
@ -73,10 +93,9 @@ export default function DocumentTables(props: IProps) {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
/* TODO: review
|
||||
// TODO: review
|
||||
fetchDocuments();
|
||||
fetchDocumentsNotary();
|
||||
*/
|
||||
//fetchDocumentsNotary();
|
||||
}, [fetchDocuments, fetchDocumentsNotary]);
|
||||
|
||||
const openDeleteAskedDocumentModal = useCallback(
|
||||
|
@ -106,14 +106,11 @@ export default function FolderInformation(props: IProps) {
|
||||
*/
|
||||
|
||||
// TODO: review
|
||||
return new Promise<any>((resolve: (value: any) => void) => {
|
||||
FolderService.getFolderByUid(folderUid).then((process: any) => {
|
||||
if (process) {
|
||||
const folder: any = process.processData;
|
||||
setFolder(folder);
|
||||
resolve(folder);
|
||||
}
|
||||
});
|
||||
return FolderService.getFolderByUid(folderUid).then((process: any) => {
|
||||
if (process) {
|
||||
const folder: any = process.processData;
|
||||
setFolder(folder);
|
||||
}
|
||||
});
|
||||
}, [folderUid]);
|
||||
|
||||
@ -129,7 +126,7 @@ export default function FolderInformation(props: IProps) {
|
||||
const fetchData = useCallback(() => {
|
||||
setIsLoading(true);
|
||||
return fetchFolder()
|
||||
.then((folder) => {
|
||||
.then(() => {
|
||||
// TODO: review
|
||||
//return fetchAnchorStatus()
|
||||
})
|
||||
|
@ -27,14 +27,16 @@ export default function Folder() {
|
||||
// TODO: review
|
||||
FolderService.getFolders().then((processes: any[]) => {
|
||||
if (processes.length > 0) {
|
||||
const folders: any[] = processes.map((process: any) => process.processData);
|
||||
let folders: any[] = processes.map((process: any) => process.processData);
|
||||
|
||||
const foldersLive = folders.filter((folder: any) => folder.isArchived === 'false');
|
||||
if (foldersLive.length !== 0) {
|
||||
// FilterBy status
|
||||
folders = folders.filter((folder: any) => folder.status === EFolderStatus.LIVE);
|
||||
|
||||
if (folders.length > 0) {
|
||||
router.push(
|
||||
Module.getInstance()
|
||||
.get()
|
||||
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", foldersLive[foldersLive.length - 1].uid)
|
||||
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", folders[0].uid)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user