refactor(client): assign tasks data to tasks variable on initial sync

This commit is contained in:
Blade Barringer
2016-06-21 07:34:44 -05:00
parent 138217fe6a
commit cfacf039df

View File

@@ -70,7 +70,8 @@ angular.module('habitrpg')
}
function sync() {
var tasks = [];
var tasks;
return $http({
method: "GET",
url: '/api/v3/user/',
@@ -106,7 +107,7 @@ angular.module('habitrpg')
})
// refresh all but completed todos
.then(function (response) {
tasks.push.apply(tasks, response.data.data);
tasks = response.data.data;
// only refresh completed todos if the user has the completed tabs list open
if ($rootScope.lists && $rootScope.$state && $rootScope.$state.current.name == 'tasks' && _.find($rootScope.lists, {'type':'todo'}).view == 'complete') {