ro
c5afbb9131
removed all remaining API requests from the front end and removed the FipamoAdminAPI js file, changing it to ContentRequest as it now handles posting data to the system directly, authenticating it self by checking the embedded CSRF token that regulary rotates also renamed MaintenanceManager to Maintenance request and moved it to the same dir as ContentRequest as they are both libraries that connect to the backend
37 lines
835 B
JavaScript
37 lines
835 B
JavaScript
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
|
|
//--------------------------
|
|
}
|