u
This commit is contained in:
parent
33f7d7ac8a
commit
bc34ed2e39
8 changed files with 43 additions and 17 deletions
|
@ -84,20 +84,20 @@ router.get('/:campaign/:list/:subscription', (req, res, next) => {
|
|||
});
|
||||
};
|
||||
|
||||
if (campaign.templateUrl) {
|
||||
if (campaign.sourceUrl) {
|
||||
let form = tools.getMessageLinks(serviceUrl, campaign, list, subscription);
|
||||
Object.keys(subscription.mergeTags).forEach(key => {
|
||||
form[key] = subscription.mergeTags[key];
|
||||
});
|
||||
request.post({
|
||||
url: campaign.templateUrl,
|
||||
url: campaign.sourceUrl,
|
||||
form
|
||||
}, (err, httpResponse, body) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if (httpResponse.statusCode !== 200) {
|
||||
return next(new Error('Received status code ' + httpResponse.statusCode + ' from ' + campaign.templateUrl));
|
||||
return next(new Error('Received status code ' + httpResponse.statusCode + ' from ' + campaign.sourceUrl));
|
||||
}
|
||||
renderAndShow(body && body.toString(), false);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue