Fixed member modal on front page

This commit is contained in:
Keith Holliday
2016-05-16 09:54:22 -05:00
parent ad03cc8f9a
commit 11b567038e
4 changed files with 17 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
'use strict';
angular.module('habitrpg')
.factory('Members', [ '$rootScope', 'Shared', 'ApiUrl', '$resource', '$http', '$q',
function($rootScope, Shared, ApiUrl, $resource, $http, $q) {
.factory('Members', [ '$rootScope', 'Shared', 'ApiUrl', '$http', '$q',
function($rootScope, Shared, ApiUrl, $http, $q) {
var members = {};
var selectedMember = {};
var apiV3Prefix = '/api/v3';

View File

@@ -6,18 +6,21 @@ window.habitrpg = angular.module('habitrpg', ['chieffancypants.loadingBar', 'ui.
.constant("STORAGE_SETTINGS_ID", 'habit-mobile-settings')
.constant("MOBILE_APP", false)
.controller("RootCtrl", ['$scope', '$location', '$modal', '$http', 'Stats', function($scope, $location, $modal, $http, Stats){
.controller("RootCtrl", ['$scope', '$location', '$modal', '$http', 'Stats', 'Members',
function($scope, $location, $modal, $http, Stats, Members) {
var memberId = $location.search()['memberId'];
if (memberId) {
$http.get('/api/v2/members/'+memberId).success(function(data, status, headers, config){
$scope.profile = window.habitrpgShared.wrap(data, false);
$scope.statCalc = Stats;
$scope.Content = window.habitrpgShared.content;
$modal.open({
templateUrl: 'modals/member.html',
scope: $scope
Members.fetchMember(memberId)
.success(function(response) {
$scope.profile = response.data;
$scope.statCalc = Stats;
$scope.Content = window.habitrpgShared.content;
$modal.open({
templateUrl: 'modals/member.html',
scope: $scope
});
});
})
}
$http.defaults.headers.common['x-client'] = 'habitica-web';

View File

@@ -136,6 +136,7 @@
"js/services/statServices.js",
"js/services/taskServices.js",
"js/services/tagsServices.js",
"js/services/memberServices.js",
"js/controllers/authCtrl.js",
"js/controllers/footerCtrl.js"
],
@@ -172,6 +173,7 @@
"js/services/taskServices.js",
"js/services/tagsServices.js",
"js/services/userServices.js",
"js/services/memberServices.js",
"js/controllers/authCtrl.js",
"js/controllers/footerCtrl.js"
],

View File

@@ -33,7 +33,7 @@ let api = {};
api.getMember = {
method: 'GET',
url: '/members/:memberId',
middlewares: [authWithHeaders()],
middlewares: [],
async handler (req, res) {
req.checkParams('memberId', res.t('memberIdRequired')).notEmpty().isUUID();