-
-
Save lukegalea/6543410 to your computer and use it in GitHub Desktop.
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
CoachApp.IndexRoute = Ember.Route.extend | |
model: (params) -> | |
client_id = localStorage.getItem 'clientId' | |
localStorage.removeItem('clientId') | |
if CoachApp.get('token')? and client_id? and !isNaN(client_id, 10) | |
CoachApp.Client.findById client_id | |
afterModel: (client) -> | |
if client | |
@transitionTo 'client', client | |
else if CoachApp.get('token')? | |
@transitionTo 'clients' | |
else | |
# Do nothing!! Let's just render the instructions page | |
renderTemplate: -> @render if Env.testing 'jasmine' else 'index' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment