2018-09-25 16:28:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Component from '@ember/component';
|
2018-04-03 14:16:57 +00:00
|
|
|
import { task } from 'ember-concurrency';
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Component.extend({
|
|
|
|
store: service(),
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
// Public API
|
|
|
|
//value for the external mount selector
|
|
|
|
value: null,
|
|
|
|
onChange: () => {},
|
|
|
|
|
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.get('authMethods').perform();
|
|
|
|
},
|
|
|
|
|
|
|
|
authMethods: task(function*() {
|
|
|
|
let methods = yield this.get('store').findAll('auth-method');
|
|
|
|
if (!this.get('value')) {
|
|
|
|
this.set('value', methods.get('firstObject.accessor'));
|
|
|
|
}
|
|
|
|
return methods;
|
|
|
|
}).drop(),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
change(value) {
|
|
|
|
this.get('onChange')(value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|