Skip to content

Commit

Permalink
add zaaktype
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Oct 23, 2024
1 parent fb9a593 commit 9c068e5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/store/modules/zaakTypen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('ZaakTypen Store', () => {

store.setZaakTypeList(mockZaakType())

expect(store.zaakTypenList).toHaveLength(mockZaakType().length)
expect(store.zaakTypeList).toHaveLength(mockZaakType().length)

store.zaakTypenList.forEach((item, index) => {
expect(item).toBeInstanceOf(ZaakType)
Expand Down
8 changes: 4 additions & 4 deletions src/store/modules/zaakTypen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type TOptions = {
export const useZaakTypeStore = defineStore('zaakTypen', {
state: () => ({
zaakTypeItem: null,
zaakTypenList: [],
zaakTypeList: [],
}),
actions: {
setZaakTypeItem(zaakTypeItem: ZaakType | TZaakType) {
Expand All @@ -33,7 +33,7 @@ export const useZaakTypeStore = defineStore('zaakTypen', {
* @throws If the HTTP request fails.
* @return {Promise<{ response: Response, data: TZaakType[], entities: ZaakType[] }>} The response, raw data, and entities.
*/
async refreshZaakTypenList(search: string = null): Promise<{ response: Response, data: TZaakType[], entities: ZaakType[] }> {
async refreshZaakTypeList(search: string = null): Promise<{ response: Response, data: TZaakType[], entities: ZaakType[] }> {
let endpoint = apiEndpoint

if (search !== null && search !== '') {
Expand Down Expand Up @@ -119,7 +119,7 @@ export const useZaakTypeStore = defineStore('zaakTypen', {
throw new Error(`HTTP error! status: ${response.status}`)
}

this.refreshZaakTypenList()
this.refreshZaakTypeList()

return { response }
},
Expand Down Expand Up @@ -168,7 +168,7 @@ export const useZaakTypeStore = defineStore('zaakTypen', {
const entity = new ZaakType(data)

options.setItem && this.setZaakTypeItem(data)
this.refreshZaakTypenList()
this.refreshZaakTypeList()

return { response, data, entity }
},
Expand Down
8 changes: 4 additions & 4 deletions src/store/modules/zaken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type TOptions = {
/**
* Save the zaak item to the store in 'zaakItem'
*/
setZaakItem?: boolean
setItem?: boolean
}

export const useZaakStore = defineStore('zaken', {
Expand Down Expand Up @@ -86,7 +86,7 @@ export const useZaakStore = defineStore('zaken', {
const data = await response.json()
const entity = new Zaak(data)

options.setZaakItem && this.setZaakItem(data)
options.setItem && this.setZaakItem(data)

return { response, data, entity }
},
Expand Down Expand Up @@ -134,7 +134,7 @@ export const useZaakStore = defineStore('zaken', {
*/
async saveZaak(
zaakItem: Zaak | TZaak,
options: TOptions = { setZaakItem: true },
options: TOptions = { setItem: true },
): Promise<{ response: Response, data: TZaak, entity: Zaak }> {
if (!zaakItem) {
throw new Error('No zaak item to save')
Expand Down Expand Up @@ -167,7 +167,7 @@ export const useZaakStore = defineStore('zaken', {
const data = await response.json() as TZaak
const entity = new Zaak(data)

options.setZaakItem && this.setZaakItem(data)
options.setItem && this.setZaakItem(data)
this.refreshZakenList()

return { response, data, entity }
Expand Down
2 changes: 1 addition & 1 deletion src/views/zaakTypen/ZaakTypenList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { navigationStore, zaakTypeStore } from '../../store/store.js'
</NcActions>
</div>

<div v-if="!zaakTypeStore.zaakTypenList?.length">
<div v-if="!!zaakTypeStore.zaakTypenList?.length">
<NcListItem v-for="(zaaktype, i) in zaakTypeStore.zaakTypenList"
:key="`${zaaktype}${i}`"
:name="zaaktype?.name"
Expand Down
2 changes: 1 addition & 1 deletion src/views/zaken/ZaakDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export default {
this.loading = true
// get current zaak once
zaakStore.getZaak(zaakStore.zaakItem.uuid, { setZaakItem: true })
zaakStore.getZaak(zaakStore.zaakItem.uuid, { setItem: true })
.then(() => {
this.loading = false
})
Expand Down

0 comments on commit 9c068e5

Please sign in to comment.