Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into feature/PC108-…
Browse files Browse the repository at this point in the history
…108/multiple-contactmomenten
  • Loading branch information
remko48 committed Dec 17, 2024
2 parents 3006090 + 4f7c450 commit fb05acb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/store/modules/taak.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()}`
Expand Down
18 changes: 16 additions & 2 deletions src/views/widgets/TakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default {
loading: false,
isModalOpen: false,
taakItems: [],
userId: null,
itemMenu: {
show: {
text: 'Bekijk',
Expand All @@ -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 => ({
Expand Down

0 comments on commit fb05acb

Please sign in to comment.