close modal on transaction complete

This commit is contained in:
noumantahir 2024-11-11 16:27:26 +05:00
parent 7360878242
commit 5e222d69f3

View File

@ -13,6 +13,7 @@ import { ModalHeader } from '../..';
import { AuthInputContent } from '../children/authInputContent';
import { StatusContent } from '../children/statusContent';
import { HiveAuthStatus, useHiveAuth } from '../hooks/useHiveAuth';
import { Operation } from '@hiveio/dhive';
interface HiveAuthModalProps {
onClose?: () => void;
@ -37,7 +38,8 @@ export const HiveAuthModal = forwardRef(({ onClose }: HiveAuthModalProps, ref) =
broadcastActiveOps: (opsArray: any) => {
if (opsArray) {
bottomSheetModalRef.current?.show();
hiveAuth.broadcast(opsArray);
handleBroadcastRequst(opsArray);
}
},
}));
@ -62,6 +64,13 @@ export const HiveAuthModal = forwardRef(({ onClose }: HiveAuthModalProps, ref) =
}
};
const handleBroadcastRequst = async (opsArray:Operation[]) => {
const success = await hiveAuth.broadcast(opsArray);
if(success){
_closeModal();
}
}
const _closeModal = () => {
bottomSheetModalRef.current?.hide();
if (onClose) {