Skip to content
This repository has been archived by the owner on Dec 23, 2019. It is now read-only.

Commit

Permalink
feat(xdsl.modem.template): use constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephanie Moallic committed Jun 11, 2019
1 parent b001b90 commit 7943fdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
angular.module('managerApp').constant('PACK_XDSL_MODEM_TEMPLATE', {
errors: {
duplicate: 'TemplateName',
invalid: 'Invalid',
},
});
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
angular.module('managerApp').controller('XdslModemTemplateCtrl', class XdslModemTemplateCtrl {
/* @ngInject */
constructor($stateParams, $translate, $uibModal, OvhApiXdsl, TucPackXdslModemMediator,
TucToast) {
TucToast, PACK_XDSL_MODEM_TEMPLATE) {
this.$stateParams = $stateParams;
this.$translate = $translate;
this.$uibModal = $uibModal;
this.mediator = TucPackXdslModemMediator;
this.OvhApiXdsl = OvhApiXdsl;
this.templateName = null;
this.TucToast = TucToast;
this.TEMPLATE_CONSTANT = PACK_XDSL_MODEM_TEMPLATE;
}

/*= =====================================
Expand Down Expand Up @@ -47,9 +48,9 @@ angular.module('managerApp').controller('XdslModemTemplateCtrl', class XdslModem
this.getModemTemplates();
}).catch((err) => {
let errorMessage = '';
if (err.data.message.includes('TemplateName')) {
if (err.data.message.includes(this.TEMPLATE_CONSTANT.errors.duplicate)) {
errorMessage = this.$translate.instant('xdsl_modem_template_name_already_exist', { templateName: this.templateName });
} else if (err.data.message.includes('Invalid')) {
} else if (err.data.message.includes(this.TEMPLATE_CONSTANT.errors.invalid)) {
errorMessage = this.$translate.instant('xdsl_modem_template_invalid_name', { templateName: this.templateName });
} else {
errorMessage = this.$translate.instant('xdsl_modem_template_an_error_ocurred');
Expand Down

0 comments on commit 7943fdf

Please sign in to comment.