hino / app / controllers / user-management / detail.js
detail.js
Raw
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import config from '../../config/environment';

export default Controller.extend({
	userManagement : service(),
	errors : service(),
	resetPassword:service(),
	resetPasswordData:service(),

	init() {
		this._super(...arguments);
	},

	actions: {
		scrollTo(fragmentIdLink) {
			document.querySelector(`#${fragmentIdLink}`).scrollIntoView({
				behavior: 'smooth',
				block: "start",
				inline: "start"
			});
		},
		async resetUserPassword(params) {
			console.log(params);
			Ember.$.get(config.APP.api.host + "/reset-passwords/" + params).then((response) => { 
				alert('Success');
				
				//this.sendAction("select", response); 
			}).catch((e) => {
				//console.log(e.responseJSON.errors[0].title);
				//this.set("rightActionInProgress", false);
				this.set('errorMessage', e.responseJSON.errors[0].title);
			});
			// result = this.resetPasswordData.getData(params);
			// console.log($result);
		}
	}
});