diff --git a/src/register-fast-onboarding.js b/src/register-fast-onboarding.js index 1dffbcd..285cee0 100644 --- a/src/register-fast-onboarding.js +++ b/src/register-fast-onboarding.js @@ -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}`, { diff --git a/src/registered.js b/src/registered.js index 1edd731..18d125f 100644 --- a/src/registered.js +++ b/src/registered.js @@ -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}`, {