Skip to content

Commit

Permalink
Remove empty paymentError from state
Browse files Browse the repository at this point in the history
  • Loading branch information
LudvigHz committed Apr 21, 2020
1 parent 3e81f2e commit 4b6dee2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/reducers/registrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ export default createEntityReducer({
}
newState.byId[registration.id] = {
...omit(newState.byId[registration.id], 'unregistrationDate'),
...registration,
paymentError: (action.meta && action.meta.paymentError) || null
...registration
};
if (action.meta && action.meta.paymentError) {
mergeObjects(newState.byId[registration.id], {
paymentError: action.meta.paymentError
});
}
newState.items = union(newState.items, [registration.id]);
break;
}
Expand Down Expand Up @@ -76,8 +80,7 @@ export default createEntityReducer({
return;
}
newState.byId[registration.id] = {
...omit(newState.byId[registration.id], 'unregistrationDate'),
paymentError: action.payload.response.jsonData.detail
...omit(newState.byId[registration.id], 'unregistrationDate')
};
break;
}
Expand Down

0 comments on commit 4b6dee2

Please sign in to comment.