Skip to content

Commit

Permalink
Added error handling and message.
Browse files Browse the repository at this point in the history
  • Loading branch information
jermnelson committed Sep 18, 2019
1 parent 56a45a2 commit 28813fa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/editor/property/InputLookupQA.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ const InputLookupQA = (props) => {
const getOptions = (authorities) => {
const options = []
authorities.forEach((authority) => {
if (authority.isError) {
options.push({
label: `Error ${authority.errorObject.message} for ${authority.authURI}`,
id: shortid.generate(),
})
return
}
const authLabel = authority.authLabel
const authURI = authority.authURI
options.push({
Expand Down Expand Up @@ -178,8 +185,8 @@ const InputLookupQA = (props) => {
placeholder: props.propertyTemplate.propertyLabel,
useCache: true,
selectHintOnEnter: true,
isLoading: props.isLoading,
selected: props.selected,
isLoading: props.isLoading,
allowNew: true,
delay: 300,
onKeyDown,
Expand All @@ -201,7 +208,6 @@ const InputLookupQA = (props) => {
items: selected,
reduxPath: props.reduxPath,
}

props.changeSelections(payload)
}}
options={getOptions(authorities)}
Expand Down Expand Up @@ -237,12 +243,14 @@ const mapStateToProps = (state, ownProps) => {
const propertyTemplate = getPropertyTemplate(state, resourceTemplateId, propertyURI)
const errors = findErrors(state, ownProps.reduxPath)
const selected = itemsForProperty(state, ownProps.reduxPath)
const isLoading = state.selectorReducer.entities.qa.loading

return {
selected,
propertyTemplate,
displayValidations,
errors,
isLoading,
}
}

Expand Down

0 comments on commit 28813fa

Please sign in to comment.