fipamo/public/assets/scripts/dash/app/actions/Mailer.js

37 lines
835 B
JavaScript
Raw Permalink Normal View History

import ContentRequest from '../../libraries/ContentRequest.js';
import Notficaton from '../ui/Notifications.js';
const notify = new Notficaton();
export default class Mailer {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
sendMail(task = null, content = null) {
let text = '';
if (task == 'TEST') {
text = 'This is a test email';
} else {
text = content;
}
let mailData = {
content: text,
mail_task: task
};
let admin = new ContentRequest();
admin
.sendMail(mailData)
.then(result => {
notify.alert(result.message, true);
})
.catch(err => {
notify.alert(err.message, false);
});
}
//--------------------------
// event handlers
//--------------------------
}