managed routing home->concernement->entite->concernement->home AND direct url loading

This commit is contained in:
2023-04-19 16:17:09 +02:00
parent b551daa561
commit 45e8f31bd8
5 changed files with 96 additions and 54 deletions

View File

@@ -20,7 +20,8 @@ export const ConcernementsStore = defineStore({
concernementsByID: {},
allEntitesById: {},
opened: false,
ct_concernement: {}
ct_concernement: {},
concernements_loaded: false
}),
getters: {
@@ -52,6 +53,7 @@ export const ConcernementsStore = defineStore({
this.concernements.push(concernement);
this.concernementsByID[concernement.id] = concernement;
});
this.concernements_loaded = true;
})
.catch(error => {
console.warn('Issue with loadConcernements', error)
@@ -76,29 +78,29 @@ export const ConcernementsStore = defineStore({
}
GQL.post('', body)
.then(({ data: { data: { entitydef }}}) => {
console.log('loadContentTypeDefinition entitydef', entitydef);
// console.log('loadContentTypeDefinition entitydef', entitydef);
entitydef.fields.forEach(field => {
this.ct_concernement[field.field_name] = field;
});
console.log('loadContentTypeDefinition entitydef', this.ct_concernement);
})
},
openCloseConcernements (ids) {
openCloseConcernements (id) {
console.log(`openCloseConcernements id: ${id}`);
var state;
this.concernements.forEach((c, i) => {
state = ids.indexOf(c.id) !== -1;
state = id == c.id;
this.concernements[i].opened = this.concernementsByID[c.id].opened = state;
if (state) {
this.opened = c;
this.router.push({name: 'concernement', params: {id: c.id}});
}
});
},
resetConcernementOpened () {
this.opened = null;
},
openEntite (cid, id) {
this.router.push({name: 'concernement', params: {id: cid, eid: id}});
this.openCloseConcernements();
}
}
})