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, 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); alert("Success"); this.transitionToRoute('login'); } }) .catch((e) => { this.set("rightActionInProgress", false); this.set('errorMessages', this.errors.getErrorMessages(e)); }); } else { this.set("rightActionInProgress", false); } }); } } });