salix/front/core/services/email.js

25 lines
684 B
JavaScript
Raw Permalink Normal View History

2020-06-12 12:28:29 +00:00
import ngModule from '../module';
class Email {
constructor($http, $translate, vnApp) {
this.$http = $http;
this.vnApp = vnApp;
this.$t = $translate.instant;
}
/**
* Sends an email displaying a notification when it's sent.
*
2022-10-03 06:28:47 +00:00
* @param {String} path The email report name
2020-06-12 12:28:29 +00:00
* @param {Object} params The email parameters
* @return {Promise} Promise resolved when it's sent
*/
2022-09-22 06:48:29 +00:00
send(path, params) {
return this.$http.post(path, params)
2020-06-12 12:28:29 +00:00
.then(() => this.vnApp.showMessage(this.$t('Notification sent!')));
}
}
Email.$inject = ['$http', '$translate', 'vnApp'];
ngModule.service('vnEmail', Email);