jeudi 26 janvier 2017

emberjs component form action

I'm trying to authenticate against DRF token.

I've successfully been able to login using an auth app I have created.

I thought I'd be slick and make the login form a component.

Since making it a component however, I'm not able to login and I get an Assertion failure.

My templates/components/auth-login.hbs template looks like so ...

<form class='navbar-form navbar-right' >
<div class="form-group">


</div>
<button type="submit">Login</button>
</form>

I also have app/controllers/auth-login.js

import Ember from 'ember';

export default Ember.Controller.extend({
  session: Ember.inject.service(),

  actions: {
    authenticate: function() {
      var credentials = this.getProperties('identification', 'password'),
        authenticator = 'authenticator:jwt';

      this.get('session').authenticate(authenticator, credentials).catch((reason) => {
        this.set('errorMessage', reason.error || reason);
      });
    }
  }
});

It works as an app but not as a component.

If I blank the template, and use the auth route/app instead, it works peachy.




Aucun commentaire:

Enregistrer un commentaire