Fix some issues

This commit is contained in:
Anthony Janin 2025-07-09 08:34:48 +02:00
parent ed4b797230
commit 09a2c85119
3 changed files with 8 additions and 3 deletions

View File

@ -51,7 +51,11 @@ export default function DefaultCustomerDashboard(props: IProps) {
if (props.isReady) { if (props.isReady) {
FolderService.getFolders().then((processes: any[]) => { FolderService.getFolders().then((processes: any[]) => {
if (processes.length > 0) { if (processes.length > 0) {
const folders: any[] = processes.map((process: any) => process.processData); let folders: any[] = processes.map((process: any) => process.processData);
// Filter By customer.uid
folders = folders.filter((folder: any) => folder.customers.some((customer: any) => customer.uid === profileUid));
setFolders(folders); setFolders(folders);
} }
}); });

View File

@ -115,7 +115,7 @@ export default function ReceivedDocuments() {
let documents: any[] = processes.map((process: any) => process.processData); let documents: any[] = processes.map((process: any) => process.processData);
// FilterBy folder.uid & customer.uid // FilterBy folder.uid & customer.uid
documents = documents.filter((document: any) => document.folder.uid === folderUid && document.customer && document.customer.uid === customerUid); documents = documents.filter((document: any) => document.folder.uid === folderUid && document.customer /*&& document.customer.uid === customerUid*/);
for (const document of documents) { for (const document of documents) {
if (document.files && document.files.length > 0) { if (document.files && document.files.length > 0) {

View File

@ -139,6 +139,7 @@ export default function ClientDashboard(props: IProps) {
const fetchDocuments = useCallback( const fetchDocuments = useCallback(
async (customerUid: string | undefined) => { async (customerUid: string | undefined) => {
setDocuments([]);
LoaderService.getInstance().show(); LoaderService.getInstance().show();
return new Promise<void>((resolve: () => void) => { return new Promise<void>((resolve: () => void) => {
DocumentService.getDocuments().then(async (processes: any[]) => { DocumentService.getDocuments().then(async (processes: any[]) => {
@ -179,9 +180,9 @@ export default function ClientDashboard(props: IProps) {
*/ */
useEffect(() => { useEffect(() => {
setDocumentsNotary([]);
const customerUid = customer?.uid; const customerUid = customer?.uid;
if (!folderUid || !customerUid) return; if (!folderUid || !customerUid) return;
LoaderService.getInstance().show(); LoaderService.getInstance().show();
DocumentService.getDocuments().then(async (processes: any[]) => { DocumentService.getDocuments().then(async (processes: any[]) => {
if (processes.length > 0) { if (processes.length > 0) {