mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-30 20:15:56 +00:00
36 lines
869 B
TypeScript
36 lines
869 B
TypeScript
import Component from '@ember/component';
|
|
import { get } from '@ember/object';
|
|
import { assert } from '@ember/debug';
|
|
|
|
export default class LoginForm extends Component {
|
|
classNames = ['nacho-login-form'];
|
|
|
|
/**
|
|
* External action to be invoked on form submission
|
|
* @type {Function}
|
|
* @memberof LoginForm
|
|
*/
|
|
onSubmit: Function;
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
|
|
// Ensure that the onSubmit action passed in on instantiation is a callable action
|
|
const typeOfOnSubmit = typeof this.onSubmit;
|
|
assert(
|
|
`Expected action onSubmit to be an function (Ember action), got ${typeOfOnSubmit}`,
|
|
typeOfOnSubmit === 'function'
|
|
);
|
|
}
|
|
|
|
actions = {
|
|
/**
|
|
* Handle the login for submission
|
|
*/
|
|
userDidSubmit(this: LoginForm) {
|
|
// Trigger action on parent controller
|
|
get(this, 'onSubmit')();
|
|
}
|
|
};
|
|
}
|