diff --git a/src/store/modules/taak.js b/src/store/modules/taak.js index f5a4883..4dc9a3c 100644 --- a/src/store/modules/taak.js +++ b/src/store/modules/taak.js @@ -35,7 +35,7 @@ export const useTaakStore = defineStore('taken', { console.log('Active widget taak Id set to ' + widgetTaakId) }, /* istanbul ignore next */ // ignore this for Jest until moved into a service - async refreshTakenList(search = null, notClosed = false) { + async refreshTakenList(search = null, notClosed = false, user = null) { let endpoint = apiEndpoint const params = new URLSearchParams() @@ -45,6 +45,9 @@ export const useTaakStore = defineStore('taken', { if (notClosed) { params.append('status', 'open') } + if (user) { + params.append('medewerker', user) + } if (params.toString()) { endpoint += `?${params.toString()}` diff --git a/src/views/widgets/TakenWidget.vue b/src/views/widgets/TakenWidget.vue index 1445e22..ca60f47 100644 --- a/src/views/widgets/TakenWidget.vue +++ b/src/views/widgets/TakenWidget.vue @@ -76,6 +76,7 @@ export default { loading: false, isModalOpen: false, taakItems: [], + userId: null, itemMenu: { show: { text: 'Bekijk', @@ -100,13 +101,26 @@ export default { }, mounted() { - this.fetchTaakItems() + this.fetchUser() }, methods: { + async fetchUser() { + const getUser = await fetch('/index.php/apps/zaakafhandelapp/me') + const user = await getUser.json() + + const medewerkerList = await fetch('/index.php/apps/zaakafhandelapp/api/medewerkers') + const medewerkers = await medewerkerList.json() + + const medewerker = medewerkers.results.find((medewerker) => medewerker.email === user.user.email) + + this.userId = medewerker.id + this.fetchTaakItems() + }, fetchTaakItems() { + this.loading = true - taakStore.refreshTakenList(null, true) + taakStore.refreshTakenList(null, true, this.userId) .then(() => { this.taakItems = taakStore.takenList.map(taak => ({