Skip to content

Commit 9e5561b

Browse files
committed
some adjusts
1 parent 10d5968 commit 9e5561b

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

components/bloomerang/actions/create-constituent/create-constituent.mjs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -133,27 +133,32 @@ export default {
133133
return {};
134134
},
135135
async run({ $ }) {
136+
const data = {
137+
Type: this.type,
138+
Status: this.status,
139+
Prefix: this.prefix,
140+
Suffix: this.suffix,
141+
JobTitle: this.jobTitle,
142+
Gender: this.gender,
143+
Birthdate: this.birthdate,
144+
Employer: this.employer,
145+
Website: this.website,
146+
FacebookId: this.facebookId,
147+
TwitterId: this.twitterId,
148+
LinkedInId: this.linkedInId,
149+
PreferredCommunicationChannel: this.preferredCommunicationChannel,
150+
};
151+
if (this.type === "Individual") {
152+
data.FirstName = this.firstName;
153+
data.LastName = this.lastName;
154+
data.MiddleName = this.middleName;
155+
} else {
156+
data.FullName = this.fullName;
157+
}
158+
136159
const response = await this.bloomerang.createConstituent({
137160
$,
138-
data: {
139-
Type: this.type,
140-
Status: this.status,
141-
FullName: this.fullName,
142-
FirstName: this.firstName,
143-
LastName: this.lastName,
144-
MiddleName: this.middleName,
145-
Prefix: this.prefix,
146-
Suffix: this.suffix,
147-
JobTitle: this.jobTitle,
148-
Gender: this.gender,
149-
Birthdate: this.birthdate,
150-
Employer: this.employer,
151-
Website: this.website,
152-
FacebookId: this.facebookId,
153-
TwitterId: this.twitterId,
154-
LinkedInId: this.linkedInId,
155-
PreferredCommunicationChannel: this.preferredCommunicationChannel,
156-
},
161+
data,
157162
});
158163

159164
$.export("$summary", `Successfully created constituent with ID ${response.Id}`);

components/bloomerang/bloomerang.app.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ export default {
9595
_makeRequest({
9696
$ = this, path, ...opts
9797
}) {
98+
console.log("config: ", {
99+
url: this._baseUrl() + path,
100+
headers: this._headers(),
101+
...opts,
102+
});
103+
98104
return axios($, {
99105
url: this._baseUrl() + path,
100106
headers: this._headers(),

0 commit comments

Comments
 (0)