Fixed client dashboard when no notes
This commit is contained in:
parent
07653d6145
commit
a9b74a5716
@ -57,8 +57,15 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
const actualCustomer = folder?.customers?.find((customer) => customer.contact?.email === jwt?.email);
|
const actualCustomer = folder?.customers?.find((customer) => customer.contact?.email === jwt?.email);
|
||||||
if (!actualCustomer) throw new Error("Customer not found");
|
if (!actualCustomer) throw new Error("Customer not found");
|
||||||
|
|
||||||
const note = folder.notes?.find((note) => note.customer?.uid === actualCustomer.uid);
|
let note = folder.notes?.find((note) => note.customer?.uid === actualCustomer.uid);
|
||||||
if (!note) throw new Error("Note not found");
|
// if (!note) throw new Error("Note not found");
|
||||||
|
if (!note) {
|
||||||
|
note = {
|
||||||
|
content: "Aucune note",
|
||||||
|
created_at: new Date(),
|
||||||
|
updated_at: new Date(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const query: IGetDocumentsparams = {
|
const query: IGetDocumentsparams = {
|
||||||
where: { depositor: { uid: actualCustomer.uid }, folder_uid: folderUid as string },
|
where: { depositor: { uid: actualCustomer.uid }, folder_uid: folderUid as string },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user