import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default Controller.extend({ forgotPassword: service(), forgotPasswordData: service(), session : service(), errors : service(), didValidate: false, rightActionInProgress: false, cordovaEvents: service('ember-cordova/events'), init() { this._super(...arguments); this.get('cordovaEvents').on('deviceready', this, '_initStatusBar'); }, _initStatusBar: function() { if (window.cordova.platformId == 'ios') { if (window.StatusBar != undefined) { window.StatusBar.overlaysWebView(false); window.StatusBar.backgroundColorByHexString('#212529'); } } }, formConfig : { employeeNo : { isEditable : true }, emailAddress : { isEditable : true } }, actions: { forgotPassword() { this.get('model') .validate() .then(async ({ validations }) => { this.set('didValidate', true); if (validations.get('isValid')) { console.log(this.forgotPassword.model); this.forgotPasswordData.save(this.forgotPassword.model).then(response => { if (response != undefined) { console.log("RESPONSE DATA", response); // this.transitionToRoute('role-management.detail', response.id); } }) .catch((e) => { this.set("rightActionInProgress", false); this.set('errorMessages', this.errors.getErrorMessages(e)); }); } else { this.set("rightActionInProgress", false); } }); } } });