datacite/bracco

View on GitHub
app/controllers/providers/show/contacts/new.js

Summary

Maintainability
A
0 mins
Test Coverage
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';

export default Controller.extend({
  store: service(),
  router: service(),
  flashMessages: service(),

  actions: {
    submit(contact) {
      let self = this;
      contact
        .save()
        .then(function (c) {
          self.router.transitionTo('contacts.show', c.id);
        })
        .catch(function (reason) {
          console.debug(reason);
        });
    },
    cancel() {
      this.router.transitionTo('providers.show.contacts', this.model.provider);
    }
  }
});