From f7e702bff2be93c7b7476ab7f8ca20079a0918df Mon Sep 17 00:00:00 2001 From: danidfra Date: Thu, 12 Sep 2024 23:50:16 -0300 Subject: [PATCH] Update zap-split-schema --- src/features/zap/components/zap-pay-request-form.tsx | 3 ++- src/schemas/zap-split.ts | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/features/zap/components/zap-pay-request-form.tsx b/src/features/zap/components/zap-pay-request-form.tsx index 6b34ee926..0de681f95 100644 --- a/src/features/zap/components/zap-pay-request-form.tsx +++ b/src/features/zap/components/zap-pay-request-form.tsx @@ -54,7 +54,7 @@ const ZapPayRequestForm = ({ account, status, onClose }: IZapPayRequestForm) => const invoice = hasZapSplit ? await dispatch(zap(account, status, zapSplitData.receiveAmount * 1000, zapComment)) : await dispatch(zap(account, status, zapAmount * 1000, zapComment)); // If invoice is undefined it means the user has paid through his extension // In this case, we simply close the modal - console.log(invoice); + if (!invoice) { dispatch(closeModal('ZAP_PAY_REQUEST')); // Dispatch the adm account @@ -64,6 +64,7 @@ const ZapPayRequestForm = ({ account, status, onClose }: IZapPayRequestForm) => return; } // open QR code modal + dispatch(closeModal('ZAP_PAY_REQUEST')); dispatch(openModal('ZAP_INVOICE', { account, invoice, splitData })); }; diff --git a/src/schemas/zap-split.ts b/src/schemas/zap-split.ts index 12feef835..c2323d773 100644 --- a/src/schemas/zap-split.ts +++ b/src/schemas/zap-split.ts @@ -1,12 +1,12 @@ import { z } from 'zod'; -import { accountSchema } from './account'; +import { type Account, accountSchema } from './account'; -const addMethodsToAccount = (account: any) => { +const addMethodsToAccount = (account: Account) => { return { ...account, - get: (key: string) => account[key], - getIn: (path: string[]) => path.reduce((acc, key) => acc[key], account), + get: (key: string) => (account as any)[key], + getIn: (path: string[]) => path.reduce((acc, key) => (acc as any)[key], account), toJS: () => account, }; };