mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Updated task service to use api v3 (#7136)
* Updated task service to use api v3 * Add user.ops functions back * Removed extra parameter
This commit is contained in:
committed by
Matteo Pagliazzi
parent
78a8eea79a
commit
4c37417bd4
@@ -180,12 +180,20 @@ window.habitrpg = angular.module('habitrpg',
|
||||
url: '/:cid',
|
||||
templateUrl: 'partials/options.social.challenges.detail.html',
|
||||
title: env.t('titleChallenges'),
|
||||
controller: ['$scope', 'Challenges', '$stateParams',
|
||||
function ($scope, Challenges, $stateParams) {
|
||||
controller: ['$scope', 'Challenges', '$stateParams', 'Tasks',
|
||||
function ($scope, Challenges, $stateParams, Tasks) {
|
||||
Challenges.getChallenge($stateParams.cid)
|
||||
.then(function (response) {
|
||||
$scope.obj = $scope.challenge = response.data.data;
|
||||
$scope.challenge._locked = true;
|
||||
return Tasks.getChallengeTasks($scope.challenge._id);
|
||||
})
|
||||
.then(function (response) {
|
||||
var tasks = response.data.data;
|
||||
tasks.forEach(function (element, index, array) {
|
||||
if (!$scope.challenge[element.type + 's']) $scope.challenge[element.type + 's'] = [];
|
||||
$scope.challenge[element.type + 's'].push(element);
|
||||
})
|
||||
});
|
||||
}]
|
||||
})
|
||||
@@ -193,12 +201,20 @@ window.habitrpg = angular.module('habitrpg',
|
||||
url: '/:cid/edit',
|
||||
templateUrl: 'partials/options.social.challenges.detail.html',
|
||||
title: env.t('titleChallenges'),
|
||||
controller: ['$scope', 'Challenges', '$stateParams',
|
||||
function ($scope, Challenges, $stateParams) {
|
||||
controller: ['$scope', 'Challenges', '$stateParams', 'Tasks',
|
||||
function ($scope, Challenges, $stateParams, Tasks) {
|
||||
Challenges.getChallenge($stateParams.cid)
|
||||
.then(function (response) {
|
||||
$scope.obj = $scope.challenge = response.data.data;
|
||||
$scope.challenge._locked = false;
|
||||
return Tasks.getChallengeTasks($scope.challenge._id);
|
||||
})
|
||||
.then(function (response) {
|
||||
var tasks = response.data.data;
|
||||
tasks.forEach(function (element, index, array) {
|
||||
if (!$scope.challenge[element.type + 's']) $scope.challenge[element.type + 's'] = [];
|
||||
$scope.challenge[element.type + 's'].push(element);
|
||||
})
|
||||
});
|
||||
}]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user