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. * * @param {String} path The email report name * @param {Object} params The email parameters * @return {Promise} Promise resolved when it's sent */ send(path, params) { return this.$http.post(path, params) .then(() => this.vnApp.showMessage(this.$t('Notification sent!'))); } } Email.$inject = ['$http', '$translate', 'vnApp']; ngModule.service('vnEmail', Email);