Skip to content

Commit

Permalink
replace map.getorelse with fold
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziofff committed May 12, 2020
1 parent a51926d commit 9591067
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ts/IdentificationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,15 @@ class IdentificationModal extends React.PureComponent<Props, State> {
});
}

const previousAttempts = prevProps.identificationFailState
.map(x => x.remainingAttempts)
.getOrElse(Number.MAX_VALUE);
const currentAttempts = this.props.identificationFailState
.map(x => x.remainingAttempts)
.getOrElse(Number.MAX_VALUE);
const previousAttempts = prevProps.identificationFailState.fold(
Number.MAX_VALUE,
x => x.remainingAttempts
);

const currentAttempts = this.props.identificationFailState.fold(
Number.MAX_VALUE,
x => x.remainingAttempts
);

// trigger an update in the management of the updateInterval if the attempts or the state
// `canInsertPinTooManyAttempts` is changed
Expand Down

0 comments on commit 9591067

Please sign in to comment.