Added loading state to set hook modal
This commit is contained in:
@@ -74,8 +74,15 @@ export const SetHookDialog: React.FC<{ account: IAccount }> = ({ account }) => {
|
|||||||
if (!account) {
|
if (!account) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<SetHookData> = async (data) => {
|
const onSubmit: SubmitHandler<SetHookData> = async (data) => {
|
||||||
|
const currAccount = state.accounts.find(
|
||||||
|
(acc) => acc.address === account.address
|
||||||
|
);
|
||||||
|
if (currAccount) currAccount.isLoading = true;
|
||||||
const res = await deployHook(account, data);
|
const res = await deployHook(account, data);
|
||||||
|
if (currAccount) currAccount.isLoading = false;
|
||||||
|
|
||||||
if (res && res.engine_result === "tesSUCCESS") {
|
if (res && res.engine_result === "tesSUCCESS") {
|
||||||
toast.success("Transaction succeeded!");
|
toast.success("Transaction succeeded!");
|
||||||
return setIsSetHookDialogOpen(false);
|
return setIsSetHookDialogOpen(false);
|
||||||
@@ -227,7 +234,11 @@ export const SetHookDialog: React.FC<{ account: IAccount }> = ({ account }) => {
|
|||||||
<Button outline>Cancel</Button>
|
<Button outline>Cancel</Button>
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
{/* <DialogClose asChild> */}
|
{/* <DialogClose asChild> */}
|
||||||
<Button variant="primary" type="submit">
|
<Button
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
isLoading={account.isLoading}
|
||||||
|
>
|
||||||
Set Hook
|
Set Hook
|
||||||
</Button>
|
</Button>
|
||||||
{/* </DialogClose> */}
|
{/* </DialogClose> */}
|
||||||
|
|||||||
Reference in New Issue
Block a user