Prevent breaking search when server does not return an object

This commit is contained in:
Vlad
2018-05-21 11:20:37 -04:00
parent 77d2f0224b
commit ca1be42ab8

View File

@@ -108,10 +108,11 @@ const Selection = React.createClass({
};
},
processResults: function processResults(response) {
return {
results: response.data.map(item => (
{ id: item.id || item.value, text: item.name || item.text }
)),
return { results: (!_.has(response, 'data')) ?
[] :
response.data.map(item =>
({ id: item.id || item.value, text: item.name || item.text })
),
};
},
},