Fixed notary doc on customer delete
This commit is contained in:
parent
a5cf8ec310
commit
5f28aa9268
@ -14,6 +14,7 @@ import classes from "./classes.module.scss";
|
|||||||
import ClientBox from "./ClientBox";
|
import ClientBox from "./ClientBox";
|
||||||
import DocumentTables from "./DocumentTables";
|
import DocumentTables from "./DocumentTables";
|
||||||
import EmailReminder from "./EmailReminder";
|
import EmailReminder from "./EmailReminder";
|
||||||
|
import DocumentsNotary from "@Front/Api/LeCoffreApi/Notary/DocumentsNotary/DocumentsNotary";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
folder: OfficeFolder;
|
folder: OfficeFolder;
|
||||||
@ -57,8 +58,19 @@ export default function ClientView(props: IProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleClientDelete = useCallback(
|
const handleClientDelete = useCallback(
|
||||||
(customerUid: string) => {
|
async (customerUid: string) => {
|
||||||
if (!folder.uid) return;
|
if (!folder.uid) return;
|
||||||
|
const documentsNotary = await DocumentsNotary.getInstance().get({
|
||||||
|
where: { customer: { uid: customerUid }, folder: { uid: folder.uid } },
|
||||||
|
});
|
||||||
|
console.log(documentsNotary);
|
||||||
|
|
||||||
|
if (documentsNotary.length > 0) {
|
||||||
|
documentsNotary.forEach(async (doc) => {
|
||||||
|
await DocumentsNotary.getInstance().delete(doc.uid!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Folders.getInstance().put(
|
Folders.getInstance().put(
|
||||||
folder.uid,
|
folder.uid,
|
||||||
OfficeFolder.hydrate<OfficeFolder>({
|
OfficeFolder.hydrate<OfficeFolder>({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user