emit event when user is synced and update code to use it

This commit is contained in:
Matteo Pagliazzi
2013-11-12 16:23:21 +01:00
parent 5ddf54466c
commit d797c21075
2 changed files with 6 additions and 4 deletions

View File

@@ -37,11 +37,10 @@ habitrpg.controller('SettingsCtrl',
$scope.avalaibleLanguages = window.env.avalaibleLanguages;
$scope.changeLanguage = function(){
User.set('preferences.language', $scope.language);
// FIXME we wait 1sec hoping that in the meantime the server has responded to the `set`
setTimeout(function(){
$rootScope.$on('userSynced', function(){
location.reload();
}, 1000);
});
User.set('preferences.language', $scope.language);
}
$scope.reroll = function(){