Created
March 15, 2016 19:09
-
-
Save zacharygolba/4b97ff8ee87213dd9d55 to your computer and use it in GitHub Desktop.
Lux Controller - Example 2
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
import { Controller, action } from 'lux-framework'; | |
class UsersController extends Controller { | |
params = [ | |
'name', | |
'email', | |
'password' | |
]; | |
@action | |
async login(req, res) { | |
const User = this.store.modelFor('user'); | |
const user = await User.authenticate(req.params); | |
if (user) { | |
req.session.set('currentUserId', user.id); | |
} | |
return user; | |
} | |
} | |
export default UsersController; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment