mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
refactor(client): assign tasks data to tasks variable on initial sync
This commit is contained in:
@@ -70,7 +70,8 @@ angular.module('habitrpg')
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sync() {
|
function sync() {
|
||||||
var tasks = [];
|
var tasks;
|
||||||
|
|
||||||
return $http({
|
return $http({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: '/api/v3/user/',
|
url: '/api/v3/user/',
|
||||||
@@ -106,7 +107,7 @@ angular.module('habitrpg')
|
|||||||
})
|
})
|
||||||
// refresh all but completed todos
|
// refresh all but completed todos
|
||||||
.then(function (response) {
|
.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
|
// 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') {
|
if ($rootScope.lists && $rootScope.$state && $rootScope.$state.current.name == 'tasks' && _.find($rootScope.lists, {'type':'todo'}).view == 'complete') {
|
||||||
|
|||||||
Reference in New Issue
Block a user