fix(core): update

This commit is contained in:
Philipp Kunz 2019-10-28 16:15:16 +01:00
parent 354c38a429
commit c60702fb49

View File

@ -14,7 +14,7 @@ export class MailgunAccount {
method: 'GET', method: 'GET',
headers: { headers: {
Authorization: `Basic ${plugins.smartstring.base64.encode( Authorization: `Basic ${plugins.smartstring.base64.encode(
this.apiToken `api:${this.apiToken}`
)}`, )}`,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
@ -28,7 +28,7 @@ export class MailgunAccount {
{ {
headers: { headers: {
Authorization: `Basic ${plugins.smartstring.base64.encode( Authorization: `Basic ${plugins.smartstring.base64.encode(
this.apiToken `api:${this.apiToken}`
)}` )}`
} }
}, },
@ -75,6 +75,10 @@ export class MailgunAccount {
} }
const response = await this.postFormData(`/${domain}/messages`, formFields); const response = await this.postFormData(`/${domain}/messages`, formFields);
console.log(response); if (response.statusCode === 200) {
return response.body;
} else {
throw new Error('could not send email');
}
} }
} }