Skip to content

Commit

Permalink
Merge pull request #106 from ConductionNL/feature/PC-108-102/my-tasks
Browse files Browse the repository at this point in the history
feature/PC-108-102/my-tasks
  • Loading branch information
remko48 authored Dec 17, 2024
2 parents 9a1de73 + dc59f2b commit 4f7c450
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 4f7c450

Please sign in to comment.