Skip to content

Commit

Permalink
fix(watcher-app): fix unlock form disabling issues
Browse files Browse the repository at this point in the history
Also update error alert text.
  • Loading branch information
mkermani144 committed Sep 26, 2023
1 parent febd34a commit 8edc9b2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions apps/watcher/app/actions/@form/unlock/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ const UnlockForm = () => {
});
const { handleSubmit } = formMethods;

const noRwtToken = !!rwtPartialToken && !rwtPartialToken.amount;

useEffect(() => {
if (noRwtToken) {
if (!isInfoLoading && !rwtPartialToken?.amount) {
setAlertData({
severity: 'error',
message: 'no Permit',
message: "You don't have any permit tokens",
});
} else {
setAlertData(null);
}
}, [noRwtToken]);
}, [isInfoLoading, rwtPartialToken?.amount]);

const onSubmit: SubmitHandler<TokenAmountCompatibleFormSchema> = async (
data,
Expand Down Expand Up @@ -118,7 +116,8 @@ const UnlockForm = () => {
</AlertCard>
);

const disabled = isInfoLoading || isRsnTokenLoading || noRwtToken;
const disabled =
isInfoLoading || isRsnTokenLoading || !rwtPartialToken?.amount;

const renderTokenAmountTextField = () => (
<TokenAmountTextField
Expand Down

0 comments on commit 8edc9b2

Please sign in to comment.