Skip to content

Commit

Permalink
Merge pull request #36 from ConductionNL/feature/klant-switch-refresh
Browse files Browse the repository at this point in the history
fixed switching between klanten not refreshing data
  • Loading branch information
RalkeyOfficial authored Oct 23, 2024
2 parents 1a82cc4 + 3573c22 commit 3ca927f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/views/klanten/KlantDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export default {
},
data() {
return {
currentActiveKlant: undefined, // whole klant object
zaken: [],
taken: [],
berichten: [],
Expand All @@ -298,45 +299,50 @@ export default {
}
},
mounted() {
this.fetchKlantData(klantStore.klantItem.id);
if (klantStore.klantItem?.id) {
this.currentActiveKlant = klantStore.klantItem
this.fetchKlantData(klantStore.klantItem.id)
}
},
updated() {
if (klantStore.klantItem?.id && JSON.stringify(this.currentActiveKlant) !== JSON.stringify(klantStore.klantItem)) {
this.currentActiveKlant = klantStore.klantItem
this.fetchKlantData(klantStore.klantItem.id)
}
},
methods: {
fetchKlantData(id) {
fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/zaken`)
.then(response => response.json())
.then(data => {
if (Array.isArray(data.results)) {
this.zaken = data.results;
this.zaken = data.results
}
console.log(this.zaken);
return fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/taken`);
return fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/taken`)
})
.then(response => response.json())
.then(data => {
if (Array.isArray(data.results)) {
this.taken = data.results;
this.taken = data.results
}
console.log(this.taken);
return fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/berichten`);
return fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/berichten`)
})
.then(response => response.json())
.then(data => {
if (Array.isArray(data.results)) {
this.berichten = data.results;
this.berichten = data.results
}
console.log(this.berichten);
return fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/audit_trail`);
return fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/audit_trail`)
})
.then(response => response.json())
.then(data => {
if (Array.isArray(data)) {
this.auditTrails = data;
this.auditTrails = data
}
console.log(this.auditTrails);
})
.catch(error => {
console.error('Error fetching klant data:', error);
});
console.error('Error fetching klant data:', error)
})
},
},
}
Expand Down
21 changes: 21 additions & 0 deletions src/views/settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,27 @@ export default {
},
deep: true,
},
'zaaktypen.selectedSource': {
handler(newValue) {
if (newValue?.value === 'internal') {
this.zaaktypen.selectedRegister = ''
this.zaaktypen.selectedSchema = ''
}
},
deep: true,
},
'zaaktypen.selectedRegister': {
handler(newValue, oldValue) {
if (this.initialization === true && oldValue === '') return
if (newValue) {
this.setRegisterSchemaOptions(newValue?.value, 'zaaktypen')
oldValue !== '' && newValue?.value !== oldValue.value && (this.zaaktypen.selectedSchema = '')
}
},
deep: true,
},
'contactmomenten.selectedSource': {
handler(newValue) {
if (newValue?.value === 'internal') {
Expand Down

0 comments on commit 3ca927f

Please sign in to comment.