Skip to content

Commit

Permalink
Merge pull request #67 from ConductionNL/development
Browse files Browse the repository at this point in the history
dev to main
  • Loading branch information
remko48 authored Dec 2, 2024
2 parents 5d1aa0c + 732ae32 commit d222e76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/store/modules/contactmoment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,25 @@ export const useContactMomentStore = defineStore('contactmomenten', {
* Refresh the list of contact moments.
*
* @param search - Optional search query to filter the contact moments list. (default: `null`)
* @param notClosed
* @throws If the HTTP request fails.
* @return {Promise<{ response: Response, data: TContactMoment[], entities: ContactMoment[] }>} The response, raw data, and entities.
*/
async refreshContactMomentenList(search: string = null): Promise<{ response: Response, data: TContactMoment[], entities: ContactMoment[] }> {
async refreshContactMomentenList(search: string = null, notClosed: boolean = false): Promise<{ response: Response, data: TContactMoment[], entities: ContactMoment[] }> {
let endpoint = apiEndpoint

if (search !== null && search !== '') {
endpoint = endpoint + '?_search=' + search
}

if (notClosed) {
if (search !== null && search !== '') {
endpoint = endpoint + '&status=open'
} else {
endpoint = endpoint + '?status=open'
}
}

const response = await fetch(endpoint, {
method: 'GET',
})
Expand Down
4 changes: 2 additions & 2 deletions src/views/widgets/ContactMomentenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
this.loading = true
Promise.all([
contactMomentStore.refreshContactMomentenList(),
contactMomentStore.refreshContactMomentenList(null, true),
klantStore.refreshKlantenList(),
])
.then(([contactMomentResponse, klantResponse]) => {
Expand Down Expand Up @@ -162,7 +162,7 @@ export default {
contactMomentStore.saveContactMoment(newContactMoment)
.then(({ response }) => {
if (response.ok) {
this.fetchContactMomentItems()
this.fetchContactMomentItems(null, true)
}
})
},
Expand Down

0 comments on commit d222e76

Please sign in to comment.