From f0031dca167e3cefd27a66645d4b1adb1317dbdb Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Mon, 29 Jun 2015 14:25:20 +0300 Subject: [PATCH] Fix to the GetCoursesByUserId in Profile --- templates/js/controllers/profileController.js | 37 +++++++++++-------- templates/js/services/apiService.js | 3 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/templates/js/controllers/profileController.js b/templates/js/controllers/profileController.js index 80bfa6a..208b08a 100644 --- a/templates/js/controllers/profileController.js +++ b/templates/js/controllers/profileController.js @@ -18,6 +18,11 @@ angular.module('SeHub') apiService.getCampusesByUserId(token, id).success(function(data) { $scope.campuses = data; console.log(data); + apiService.getCoursesByUserID(token, id).success(function(data){ + $scope.courses = data; + }).error(function(err){ + console.error('In apiService.getCoursesByUserID', err); + }) $scope.loadingData = false; }).error(function(err) { @@ -53,22 +58,22 @@ angular.module('SeHub') /** * DEBUG DATA */ - $scope.courses = [{ - "courseName": "Advance Math", - "campusName": "JCE", - "startDate": { - "year": 2015, - "month": 4, - "day": 3 - }, - "endDate": { - "year": 2016, - "month": 5, - "day": 14 - }, - "taskFlag": false, - "campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg" - }]; + // $scope.courses = [{ + // "courseName": "Advance Math", + // "campusName": "JCE", + // "startDate": { + // "year": 2015, + // "month": 4, + // "day": 3 + // }, + // "endDate": { + // "year": 2016, + // "month": 5, + // "day": 14 + // }, + // "taskFlag": false, + // "campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg" + // }]; // $scope.campuses = [{ // 'title': 'JCE', diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 268ad36..5333a51 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -173,8 +173,7 @@ service.factory('apiService', ['$http', function($http) { var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + userId; req = { method : "GET", - url : url, - data: payLoad + url : url }; return $http(req); }