Created
November 17, 2017 15:58
-
-
Save alvincrespo/8798a11af90f0838a08019886f50ea82 to your computer and use it in GitHub Desktop.
Sign up route
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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