Skip to content

Commit

Permalink
change ternary expressions into if/else blocks for eslint 8
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Aug 5, 2024
1 parent 5e01a6f commit 9d9c44f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ const CustomMaskCreator = (props: CustomMaskCreatorProps) => {
event.preventDefault();

const isValid = isAddressValid(address);
isValid
? onPick(address.toLowerCase(), errorExplainerState.setOpen)
: errorExplainerState.setOpen(!isValid);
if (isValid) {
onPick(address.toLowerCase(), errorExplainerState.setOpen);
} else {
errorExplainerState.setOpen(!isValid);
}
};
const onChange: ChangeEventHandler<HTMLInputElement> = (event) => {
setAddress(event.target.value);
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/pages/accounts/profile.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ const Profile: NextPage = () => {
setAliasGeneratedState(true);
}
addonData.sendEvent("aliasListUpdate");
} catch (error) {
} catch {
// TODO: Refactor CustomAddressGenerationModal to remove the setAliasGeneratedState callback, and instead use a try catch block.
setAliasGeneratedState
? setAliasGeneratedState(false)
: toast(l10n.getString("error-mask-create-failed"), { type: "error" });

if (setAliasGeneratedState) {
setAliasGeneratedState(false);
} else {
toast(l10n.getString("error-mask-create-failed"), { type: "error" });
}
// This is so we can catch the error when calling createAlias asynchronously and apply
// more logic to handle when generating a mask fails.
return Promise.reject("Mask generation failed");
Expand Down

0 comments on commit 9d9c44f

Please sign in to comment.