onthefly create new person: adding result in suggested/selected list

This commit is contained in:
2021-08-25 18:09:48 +02:00
parent 5884fbaffc
commit e369e43b00
4 changed files with 34 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ let initPromise = getAccompanyingCourse(id)
state: {
accompanyingCourse: accompanying_course,
addressContext: {},
priorSuggestion: {},
errorMsg: []
},
getters: {
@@ -47,9 +48,25 @@ let initPromise = getAccompanyingCourse(id)
return true;
}
return false;
},
hasPriorSuggestion(state, getters) {
return state.priorSuggestion.key ? true : false;
}
},
mutations: {
newPriorSuggestion(state, entity) {
console.log('### mutation newPriorSuggestion', entity);
if (entity !== null) {
let suggestion = {
key: entity.type + entity.id,
relevance: 0.5,
result: entity
}
state.priorSuggestion = suggestion;
} else {
state.priorSuggestion = {};
}
},
catchError(state, error) {
console.log('### mutation: a new error have been catched and pushed in store !', error);
state.errorMsg.push(error);