Fixed an ever-reloading bug.

This commit is contained in:
Scott Erickson 2014-03-21 21:11:51 -07:00
parent 2cdfbf1c48
commit 0df09f7f35

View file

@ -21,10 +21,10 @@ module.exports = class LadderTabView extends CocoView
startsLoading: true startsLoading: true
events: events:
'click .connect-facebook': -> FB.login() 'click .connect-facebook': 'onConnectFacebook'
subscriptions: subscriptions:
'facebook-logged-in': -> location.reload() 'facebook-logged-in': 'onConnectedWithFacebook'
constructor: (options, @level, @sessions) -> constructor: (options, @level, @sessions) ->
super(options) super(options)
@ -32,6 +32,13 @@ module.exports = class LadderTabView extends CocoView
@leaderboards = {} @leaderboards = {}
@refreshLadder() @refreshLadder()
@checkFriends() @checkFriends()
onConnectFacebook: ->
@connecting = true
FB.login()
onConnectedWithFacebook: ->
location.reload() if @connecting
checkFriends: -> checkFriends: ->
@loadingFriends = true @loadingFriends = true