mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-19 02:04:10 +00:00
Use ApiUrlService in all services
This commit is contained in:
parent
028c136d43
commit
7a0883746c
4 changed files with 17 additions and 8 deletions
|
|
@ -9,8 +9,8 @@ var facebook = {}
|
|||
|
||||
angular.module('authServices', ['userServices']).
|
||||
factory('Facebook',
|
||||
['$http', '$location', 'User', 'API_URL',
|
||||
function($http, $location, User, API_URL) {
|
||||
['$http', '$location', 'User', 'ApiUrlService',
|
||||
function($http, $location, User, ApiUrlService) {
|
||||
//TODO FB.init({appId: '${section.parameters['facebook.app.id']}', status: true, cookie: true, xfbml: true});
|
||||
var auth, user = User.user;
|
||||
|
||||
|
|
@ -29,6 +29,8 @@ factory('Facebook',
|
|||
email: response.email
|
||||
}
|
||||
|
||||
var API_URL = ApiUrlService.getApiUrl();
|
||||
|
||||
$http.post(API_URL + '/api/v2/user/auth/facebook', data).success(function(data, status, headers, config) {
|
||||
User.authenticate(data.id, data.token, function(err) {
|
||||
if (!err) {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@
|
|||
*/
|
||||
|
||||
angular.module('challengeServices', ['ngResource']).
|
||||
factory('Challenges', ['API_URL', '$resource', 'User', '$q', 'Members',
|
||||
function(API_URL, $resource, User, $q, Members) {
|
||||
factory('Challenges', ['ApiUrlService', '$resource', 'User', '$q', 'Members',
|
||||
function(ApiUrlService, $resource, User, $q, Members) {
|
||||
var API_URL = ApiUrlService.getApiUrl();
|
||||
|
||||
var Challenge = $resource(API_URL + '/api/v2/challenges/:cid',
|
||||
{cid:'@_id'},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@
|
|||
*/
|
||||
|
||||
angular.module('groupServices', ['ngResource']).
|
||||
factory('Groups', ['API_URL', '$resource', '$q', '$http', 'User',
|
||||
function(API_URL, $resource, $q, $http, User) {
|
||||
factory('Groups', ['ApiUrlService', '$resource', '$q', '$http', 'User',
|
||||
function(ApiUrlService, $resource, $q, $http, User) {
|
||||
var API_URL = ApiUrlService.getApiUrl();
|
||||
|
||||
var Group = $resource(API_URL + '/api/v2/groups/:gid',
|
||||
{gid:'@_id', messageId: '@_messageId'},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
*/
|
||||
|
||||
angular.module('memberServices', ['ngResource', 'sharedServices']).
|
||||
factory('Members', ['$rootScope', 'Shared', 'API_URL', '$resource',
|
||||
function($rootScope, Shared, API_URL, $resource) {
|
||||
factory('Members', ['$rootScope', 'Shared', 'ApiUrlService', '$resource',
|
||||
function($rootScope, Shared, ApiUrlService, $resource) {
|
||||
|
||||
var API_URL = ApiUrlService.getApiUrl();
|
||||
|
||||
var members = {};
|
||||
var Member = $resource(API_URL + '/api/v2/members/:uid', {uid:'@_id'});
|
||||
var memberServices = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue