Skip to content

Commit

Permalink
#328 added inGebruik parameter and old address story
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelVerstappen committed Nov 21, 2024
1 parent 3123890 commit 0daef8d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/services/crab-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,42 @@ export class CrabApiService extends HttpService {
}

async getGemeentenPerGewest(niscode: Niscode): Promise<IGemeente[]> {
return (await this.get<IGemeente[]>(`adressenregister/gewesten/${niscode}/gemeenten`, { baseURL: this.API_URL }))
.data;
return (
await this.get<IGemeente[]>(`adressenregister/gewesten/${niscode}/gemeenten?status=inGebruik`, {
baseURL: this.API_URL,
})
).data;
}

async getPostinfo(gemeente: string): Promise<IPostinfo[]> {
return (await this.get<IPostinfo[]>(`adressenregister/gemeenten/${gemeente}/postinfo`, { baseURL: this.API_URL }))
.data;
return (
await this.get<IPostinfo[]>(`adressenregister/gemeenten/${gemeente}/postinfo?status=inGebruik`, {
baseURL: this.API_URL,
})
).data;
}

async getStraten(gemeente: string): Promise<IStraat[]> {
return (await this.get<IStraat[]>(`adressenregister/gemeenten/${gemeente}/straten`, { baseURL: this.API_URL }))
.data;
return (
await this.get<IStraat[]>(`adressenregister/gemeenten/${gemeente}/straten?status=inGebruik`, {
baseURL: this.API_URL,
})
).data;
}

async getAdressen(straat: string, huisnummer?: string): Promise<IAdres[]> {
if (huisnummer) {
return (
await this.get<IAdres[]>(`adressenregister/straten/${straat}/huisnummers/${huisnummer}`, {
await this.get<IAdres[]>(`adressenregister/straten/${straat}/huisnummers/${huisnummer}?status=inGebruik`, {
baseURL: this.API_URL,
})
).data;
}
return (await this.get<IAdres[]>(`adressenregister/straten/${straat}/adressen`, { baseURL: this.API_URL })).data;
return (
await this.get<IAdres[]>(`adressenregister/straten/${straat}/adressen?status=inGebruik`, {
baseURL: this.API_URL,
})
).data;
}

public async searchPerceel(coordinate: Coordinate, srsName: string) {
Expand Down
50 changes: 50 additions & 0 deletions src/stories/smart-components/adres.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,56 @@ export const TwoWayBinding: Story = {
}),
};

export const OldAddresses: Story = {
args: {
adres: {
land: {
code: 'BE',
naam: 'België',
},
gemeente: {
naam: 'Herzele',
niscode: '41027',
},
postcode: {
nummer: '9550',
uri: 'https://data.vlaanderen.be/id/postinfo/9550',
},
straat: {
naam: 'Provincieweg',
id: '229270',
uri: 'https://data.vlaanderen.be/doc/straatnaam/229270',
},
},
},
render: ({ adres }: ILocatieAdres) => ({
components: { OeAdres },
inheritAttrs: false,
setup() {
return { adres };
},
template: `
<div>
<Suspense>
<OeAdres v-model:adres="adres" @update:adres="onUpdateAdres" />
</Suspense>
<h3>Adres:</h3>
<pre>{{ eventOutput }}</pre>
</div>
`,
data() {
return {
eventOutput: '' as string,
};
},
methods: {
onUpdateAdres(payload: ILocatieAdres) {
this.eventOutput = payload;
},
},
}),
};

export const MultiSelectOptionsLimit: Story = {
args: {
optionsLimit: 5000,
Expand Down

0 comments on commit 0daef8d

Please sign in to comment.