Skip to content

Instantly share code, notes, and snippets.

@alvincrespo
Created November 17, 2017 15:58
Show Gist options
  • Save alvincrespo/8798a11af90f0838a08019886f50ea82 to your computer and use it in GitHub Desktop.
Save alvincrespo/8798a11af90f0838a08019886f50ea82 to your computer and use it in GitHub Desktop.
Sign up route
// auth-example-frontend/routes/sign-up.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
const AUTHENTICATOR = 'authenticator:oauth2';
export default Route.extend({
session: service(),
actions: {
async onSignUp(email, password) {
let attrs = { email, password };
let user = this.store.createRecord('user', attrs);
await user.save();
let session = this.get('session');
await session.authenticate(AUTHENTICATOR, email, password);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment