Update zap-split-schema

This commit is contained in:
danidfra 2024-09-12 23:50:16 -03:00
parent 1c8a2d1b97
commit f7e702bff2
2 changed files with 6 additions and 5 deletions

View File

@ -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)); 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 // If invoice is undefined it means the user has paid through his extension
// In this case, we simply close the modal // In this case, we simply close the modal
console.log(invoice);
if (!invoice) { if (!invoice) {
dispatch(closeModal('ZAP_PAY_REQUEST')); dispatch(closeModal('ZAP_PAY_REQUEST'));
// Dispatch the adm account // Dispatch the adm account
@ -64,6 +64,7 @@ const ZapPayRequestForm = ({ account, status, onClose }: IZapPayRequestForm) =>
return; return;
} }
// open QR code modal // open QR code modal
dispatch(closeModal('ZAP_PAY_REQUEST'));
dispatch(openModal('ZAP_INVOICE', { account, invoice, splitData })); dispatch(openModal('ZAP_INVOICE', { account, invoice, splitData }));
}; };

View File

@ -1,12 +1,12 @@
import { z } from 'zod'; import { z } from 'zod';
import { accountSchema } from './account'; import { type Account, accountSchema } from './account';
const addMethodsToAccount = (account: any) => { const addMethodsToAccount = (account: Account) => {
return { return {
...account, ...account,
get: (key: string) => account[key], get: (key: string) => (account as any)[key],
getIn: (path: string[]) => path.reduce((acc, key) => acc[key], account), getIn: (path: string[]) => path.reduce((acc, key) => (acc as any)[key], account),
toJS: () => account, toJS: () => account,
}; };
}; };