diff options
Diffstat (limited to 'public/assets/js/lib')
| -rw-r--r-- | public/assets/js/lib/router.js | 9 | ||||
| -rw-r--r-- | public/assets/js/lib/views/login/login.js | 26 |
2 files changed, 21 insertions, 14 deletions
diff --git a/public/assets/js/lib/router.js b/public/assets/js/lib/router.js index 30646c1..5bc05c3 100644 --- a/public/assets/js/lib/router.js +++ b/public/assets/js/lib/router.js @@ -5,19 +5,14 @@ var SiteRouter = Router.extend({ el: "body", routes: { - "/": 'lobby', + "/": 'login', "/index": 'index', "/login": 'login', "/details/:id": 'room', }, initialize: function(){ - if (! user.username) { - app.view = new LoginView() - } - else { - this.route() - } + this.route() }, index: function(){ diff --git a/public/assets/js/lib/views/login/login.js b/public/assets/js/lib/views/login/login.js index 06d8808..a48b404 100644 --- a/public/assets/js/lib/views/login/login.js +++ b/public/assets/js/lib/views/login/login.js @@ -1,14 +1,26 @@ var LoginView = FormView.extend({ - - events: { - }, + + el: "#login", + action: "/api/login", + method: "POST", initialize: function(opt){ - // opt.parent = parent + this.__super__.initialize.call(this) + this.$("[name=username]").focus() + }, + + showErrors: function(errors){ + console.log(errors) }, - success: function(){ - window.location.href = "/index" + success: function(data){ + console.log(data) + if (data.returnTo) { + window.location.href = "/index" + } + else { + window.location.href = "/index" + } }, -})
\ No newline at end of file +}) |
