mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
challenges: WIP beginning challenges feature. some basic CRUD & some
basic subscribe / unsubscribe functional (but buggy)
This commit is contained in:
25
public/js/services/challengeServices.js
Normal file
25
public/js/services/challengeServices.js
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Services that persists and retrieves user from localStorage.
|
||||
*/
|
||||
|
||||
angular.module('challengeServices', ['ngResource']).
|
||||
factory('Challenges', ['API_URL', '$resource', 'User', '$q', 'Members',
|
||||
function(API_URL, $resource, User, $q, Members) {
|
||||
var Challenge = $resource(API_URL + '/api/v1/challenges/:cid',
|
||||
{cid:'@_id'},
|
||||
{
|
||||
//'query': {method: "GET", isArray:false}
|
||||
join: {method: "POST", url: API_URL + '/api/v1/challenges/:cid/join'},
|
||||
leave: {method: "POST", url: API_URL + '/api/v1/challenges/:cid/leave'}
|
||||
});
|
||||
|
||||
//var challenges = [];
|
||||
|
||||
return {
|
||||
Challenge: Challenge
|
||||
//challenges: challenges
|
||||
}
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user