Skip to content

Commit

Permalink
fix: remove unnecessary fields in PATCH
Browse files Browse the repository at this point in the history
Elements in the codeHosting array contain fields such as `createdAt`
and `updatedAt`.
  • Loading branch information
tensor5 committed Oct 22, 2024
1 parent 76882d7 commit 48dfce9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/register-fast-onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ async function createPublisher(apiURL, pasetoApiToken, pec, amministrazione, ipa
}

async function updateExistingPublisher(apiURL, pasetoApiToken, publisherID, pec, url, codeHosting) {
// Clean up the codeHosting array by leaving only the url field of each element.
const cleanCodeHosting = codeHosting.map(({ url })=> ({ url }));

const apiPayload = {
email: pec,
codeHosting: [ ...codeHosting, { url } ],
codeHosting: [ ...cleanCodeHosting, { url } ],
};

const res = await fetch(`${apiURL}/publishers/${publisherID}`, {
Expand Down
5 changes: 4 additions & 1 deletion src/registered.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,12 @@ async function createPublisher(apiURL, pasetoApiToken, pec, amministrazione, ipa
}

async function updateExistingPublisher(apiURL, pasetoApiToken, publisherID, pec, url, codeHosting) {
// Clean up the codeHosting array by leaving only the url field of each element.
const cleanCodeHosting = codeHosting.map(({ url })=> ({ url }));

const apiPayload = {
email: pec,
codeHosting: [ ...codeHosting, { url } ],
codeHosting: [ ...cleanCodeHosting, { url } ],
};

const res = await fetch(`${apiURL}/publishers/${publisherID}`, {
Expand Down

0 comments on commit 48dfce9

Please sign in to comment.