Skip to content

Commit

Permalink
Revert "fixed klant sub object niet switchen - WIP"
Browse files Browse the repository at this point in the history
This reverts commit a7dc048.
  • Loading branch information
RalkeyOfficial committed Oct 23, 2024
1 parent a7dc048 commit 44e6592
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions src/views/klanten/KlantDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ export default {
},
data() {
return {
currentActiveKlant: undefined,
zaken: [],
taken: [],
berichten: [],
Expand All @@ -299,55 +298,45 @@ export default {
}
},
mounted() {
if (klantStore.klantItem?.id) {
this.currentActiveKlant = klantStore.klantItem
this.fetchKlantData(klantStore.klantItem.id)
}
},
updated() {
// if klantStore.klantItem.id is not falsy and the currentActiveKlant is not the same as klantStore.klantItem
if (!klantStore.klantItem?.id && (JSON.stringify(this.currentActiveKlant) !== JSON.stringify(klantStore.klantItem))) {
this.currentActiveKlant = klantStore.klantItem
this.fetchKlantData(klantStore.klantItem.id)
}
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`)
console.log(this.zaken);
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`)
console.log(this.taken);
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`)
console.log(this.berichten);
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)
console.log(this.auditTrails);
})
.catch(error => {
console.error('Error fetching klant data:', error)
})
console.error('Error fetching klant data:', error);
});
},
},
}
Expand Down

0 comments on commit 44e6592

Please sign in to comment.