Skip to content

Commit

Permalink
simplify null check in user service unit select
Browse files Browse the repository at this point in the history
  • Loading branch information
NC-jsAhonen committed Nov 21, 2023
1 parent 8b74d3d commit d653abc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/components/inputs/UserServiceUnitSelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ class UserServiceUnitSelectInput extends Component<Props, State> {
userServiceUnits,
} = this.props;

if (val) {
const {value} = val;
const selected = userServiceUnits.filter((u) => u.id === val?.value)[0];

const selected = userServiceUnits.filter((u) => u.id === value)[0];

if (selected) {
setUserActiveServiceUnit(selected);
}
if (selected) {
setUserActiveServiceUnit(selected);
}
}

Expand Down

0 comments on commit d653abc

Please sign in to comment.