Skip to content

Commit

Permalink
Add basic functionality for managing missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Nov 14, 2024
1 parent 21f2a60 commit fa2e534
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class RequestForm extends React.Component {
form.change(MEDIATED_REQUEST_FORM_FIELD_NAMES.ITEM_BARCODE, request.item.barcode);
}

form.change(MEDIATED_REQUEST_FORM_FIELD_NAMES.REQUESTER_BARCODE, request.requester.barcode);
form.change(MEDIATED_REQUEST_FORM_FIELD_NAMES.REQUESTER_BARCODE, request.requester?.barcode);
form.change(MEDIATED_REQUEST_FORM_FIELD_NAMES.PATRON_COMMENTS, request.patronComments);

Promise.allSettled([
Expand Down Expand Up @@ -648,20 +648,22 @@ class RequestForm extends React.Component {
const { requestPreferences } = await findResource(RESOURCE_TYPES.REQUEST_PREFERENCES, userId);
const preferences = requestPreferences[0];
const fulfillmentPreference = getFulfillmentPreference(preferences, initialValues);
const defaultDeliveryAddressTypeId = preferences?.defaultDeliveryAddressTypeId;
const defaultServicePointId = preferences?.defaultServicePointId;

this.setState({
defaultDeliveryAddressTypeId: preferences.defaultDeliveryAddressTypeId,
defaultServicePointId: preferences.defaultServicePointId,
defaultDeliveryAddressTypeId,
defaultServicePointId,
fulfillmentPreference,
});

return {
...defaultPreferences,
defaultDeliveryAddressTypeId: preferences.defaultDeliveryAddressTypeId,
defaultServicePointId: preferences.defaultServicePointId,
hasDelivery: Boolean(preferences.delivery),
hasDelivery: Boolean(preferences?.delivery),
isDeliverySelected: isDelivery(fulfillmentPreference),
selectedAddress: preferences.defaultDeliveryAddressTypeId,
selectedAddress: defaultDeliveryAddressTypeId,
defaultDeliveryAddressTypeId,
defaultServicePointId,
fulfillmentPreference,
};
} catch (e) {
Expand Down

0 comments on commit fa2e534

Please sign in to comment.