Skip to content

Commit

Permalink
INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
lencodes committed May 5, 2023
1 parent d5334e9 commit 7117a73
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/features/klant/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ function updateContactgegevens({
emails,
}: UpdateContactgegevensParams): Promise<UpdateContactgegevensParams> {
const url = klantRootUrl + "/" + id;

const mapKlantPayload = (klant: any) => {
const _klant = klant;

delete _klant.embedded;

// remove _self from telefoonnummers and emails

return JSON.stringify({ ...klant, telefoonnummers, emails });
};

return fetchLoggedIn(url + "?fields[]=klantnummer&fields[]=bronorganisatie")
.then(throwIfNotOk)
.then(parseJson)
Expand All @@ -174,13 +185,7 @@ function updateContactgegevens({
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...klant,
embedded: {
telefoonnummers,
emails,
},
}),
body: mapKlantPayload(klant),
})
)
.then(throwIfNotOk)
Expand Down

0 comments on commit 7117a73

Please sign in to comment.