Skip to content

Commit

Permalink
access VanID properly; return in case of failure; prettify
Browse files Browse the repository at this point in the history
  • Loading branch information
engelhartrueben committed Dec 5, 2024
1 parent a54cdb0 commit e2a3df9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/server/api/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1349,13 +1349,14 @@ const rootMutations = {
// If not, return and skip next steps
try {
const c = JSON.stringify(contact.customFiels);
if (!"vanId" in c) return newContact;
if (c?.VanID === undefined) return newContact;
} catch (exception) {
console.log(exception)
console.log(exception);
return newContact;
}

console.log(
"createOptOut VAN"
`createOptOut VAN ${contact.cell}`
);

const body = {
Expand All @@ -1368,13 +1369,13 @@ const rootMutations = {
}
},
"resultCodeId": 205
}
};

try {
// I am assuming here that contact has vanID.
// will need to test
await Van.postCanvassResponse(contact, organization, body);
console.log(`canvasOptOut VAN success ${contact}`)
console.log(`canvasOptOut VAN success ${contact.cell}`)
} catch (e) {
console.log(`Error opting out ${contact.cell}: ${e}`);
} finally {
Expand Down

0 comments on commit e2a3df9

Please sign in to comment.