fix gql cache probleme for getUserEntites

This commit is contained in:
Bachir Soussi Chiadmi 2024-05-29 17:47:28 +02:00
parent f683978b7c
commit 9a7db9d7d2
3 changed files with 27 additions and 5 deletions

View File

@ -215,6 +215,8 @@ export default {
'reloadConcernementEntites', 'reloadConcernementEntites',
'reloadProximites' 'reloadProximites'
]), ]),
...mapActions(UserStore, ['getUserEntitees']),
onClickInfos(){ onClickInfos(){
this.infos_opened = !this.infos_opened; this.infos_opened = !this.infos_opened;
}, },
@ -269,11 +271,22 @@ export default {
this.recordConcernementEntiteField(parag) this.recordConcernementEntiteField(parag)
.then((concernement) => { .then((concernement) => {
console.log('concernement', concernement); console.log('concernement', concernement);
// TODO reload the map item // reload the map item
this.reloadConcernementEntites(concernement.nid[0].value) this.reloadConcernementEntites(concernement.nid[0].value)
.then(() => { .then(() => {
this.reloading_concernements = false; this.reloading_concernements = false;
}); });
// TODO reset the user entites liste caching
// this.getUserEntitees()
// .then(() => {
// console.log('added entite, user entites reloaded');
// })
// .catch(error => {
// console.warn('Issue with graphql userentites loading', error);
// })
// this.reloadConcernements() // this.reloadConcernements()
// .then(() => { // .then(() => {
// this.reloading_concernements = false; // this.reloading_concernements = false;
@ -524,7 +537,8 @@ export default {
bundle: 'entite', bundle: 'entite',
id: this.entite.id, id: this.entite.id,
field: {field_name: 'title', value:'value'} field: {field_name: 'title', value:'value'}
}" /> }"
v-on:updated="reloadConcernementEntites(cid)"/>
<!-- proximité --> <!-- proximité -->
<section <section

View File

@ -393,6 +393,14 @@ export const ConcernementsStore = defineStore({
tmp_conc.revisions.push(rev); tmp_conc.revisions.push(rev);
} }
}) })
let user = UserStore();
user.getUserEntitees()
.then(() => {
console.log('reloadConcernementEntites graphql userentites loaded')
})
.catch(error => {
console.warn('Issue with graphql userentites loading', error);
})
resolve(concernement); resolve(concernement);
}) })
.catch(error => { .catch(error => {

View File

@ -184,13 +184,13 @@ export const UserStore = defineStore({
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const body = { const body = {
query: ` query: `
query UserEntites($uid: Int!){ query UserEntites($uid: Int!, $time: String){
userentites(uid: $uid) { userentites(uid: $uid, time: $time) {
id id
title title
} }
}`, }`,
variables: { uid: parseInt(this.uid) } variables: { uid: parseInt(this.uid), time: `${Date.now()}` }
} }
GQL.post('', body) GQL.post('', body)