Prevent breaking search when server does not return an object
This commit is contained in:
@@ -108,10 +108,11 @@ const Selection = React.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
processResults: function processResults(response) {
|
processResults: function processResults(response) {
|
||||||
return {
|
return { results: (!_.has(response, 'data')) ?
|
||||||
results: response.data.map(item => (
|
[] :
|
||||||
{ id: item.id || item.value, text: item.name || item.text }
|
response.data.map(item =>
|
||||||
)),
|
({ id: item.id || item.value, text: item.name || item.text })
|
||||||
|
),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user