Skip to content

Commit a741864

Browse files
committed
Pending fix retry
1 parent eccbaa1 commit a741864

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/server/routes/mailchimp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ routes.get('/campaign-folders', (req, res) => new MailchimpService().getCampaign
2929

3030
routes.get('/campaigns', (req, res) => new MailchimpService().getCampaigns(req).then(res.send.bind(res)));
3131

32-
routes.post('/email', (req, res) => sendEmail(req, res).then(res.send.bind(res)));
32+
routes.post('/email', (req, res) => sendEmail(req, res));
3333

3434
export default routes;

src/server/services/sendGrid.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ sgMail.setApiKey(config.SECRET.SENDGRID_API_KEY);
1414
* @param {Object} req the request
1515
* @param {Object} res the response
1616
*/
17-
export async function sendEmail(req, res) {
17+
export function sendEmail(req, res) {
1818
const msg = req.body;
19-
return sgMail
19+
sgMail
2020
.send(msg)
21-
.then(result => result)
21+
.then(result => res.json(result))
2222
.catch((error) => {
2323
logger.error(error);
2424
const { message, code, response } = error;
2525
res.status(code || 500);
2626
if (error.response) {
2727
const { headers, body } = response;
28-
return {
28+
res.json({
2929
message, headers, body,
30-
};
30+
});
3131
}
32-
return { message };
32+
res.json({ message });
3333
});
3434
}
3535

src/shared/containers/Gigs/RecruitCRMJobDetails.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import RecruitCRMJobApply from './RecruitCRMJobApply';
1818

1919
const cookies = require('browser-cookies');
2020

21+
const PROXY_ENDPOINT = `${config.URL.COMMUNITY_APP}/api`;
22+
2123
class RecruitCRMJobDetailsContainer extends React.Component {
2224
constructor(props) {
2325
super(props);
@@ -98,7 +100,7 @@ https://www.topcoder.com/gigs/${props.id}`,
98100
return;
99101
}
100102
// email the invite
101-
const res = await fetch('/api/mailchimp/email', {
103+
const res = await fetch(`${PROXY_ENDPOINT}/mailchimp/email`, {
102104
method: 'POST',
103105
body: JSON.stringify({
104106
from: `${profile.firstName} ${profile.lastName} via Topcoder Gigwork <[email protected]>`,
@@ -142,7 +144,7 @@ https://www.topcoder.com/gigs/${props.id}`,
142144
const { profile } = this.props;
143145
const { referralId, formData } = this.state;
144146
if (!referralId && profile.email) {
145-
const res = await fetch(`/api/growsurf/participants?participantId=${profile.email}`, {
147+
const res = await fetch(`${PROXY_ENDPOINT}/growsurf/participants?participantId=${profile.email}`, {
146148
method: 'POST',
147149
body: JSON.stringify({
148150
email: profile.email,

0 commit comments

Comments
 (0)