mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
refactor(client): assign tasks data to tasks variable on initial sync
This commit is contained in:
parent
138217fe6a
commit
cfacf039df
1 changed files with 3 additions and 2 deletions
|
|
@ -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') {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue