1 appDS2.factory('SelfProfileService', function ($http, $q) {
3 getProfileDetail: function(profileId) {
6 url: "get_profile?profile_id=" + profileId,
8 }).then(function(response) {
9 if (response.status == 200) {
12 return $q.reject(response.data);
16 }, function(response) {
17 // something went wrong
18 return $q.reject(response.data);
22 getSelfProfileDetail: function() {
23 return $http.get('get_self_profile')
24 .then(function(response) {
25 if (typeof response.data === 'object') {
28 return $q.reject(response.data);
31 }, function(response) {
32 // something went wrong
33 return $q.reject(response.data);
37 addRole: function(roleData,profileId) {
40 url: "profile/addNewRole?profile_id=" + profileId,
43 }).then(function(response) {
44 if (response.status == 200) {
47 return $q.reject(response.data);
51 }, function(response) {
52 // something went wrong
53 return $q.reject(response.data);
56 deRole: function(roleData,profileId) {
59 url: "profile/removeRole?profile_id=" + profileId,
62 }).then(function(response) {
63 if (response.status == 200) {
66 return $q.reject(response.data);
70 }, function(response) {
71 // something went wrong
72 return $q.reject(response.data);
75 saveProfile: function(data,profileId) {
78 url: "profile/saveProfile?profile_id=" + profileId,
81 }).then(function(response) {
82 if (response.status == 200) {
85 return $q.reject(response.data);
89 }, function(response) {
90 // something went wrong
91 return $q.reject(response.data);
94 removeRole: function(data,profileId) {
97 url: "profile/removeRole?profile_id=" + profileId,
100 }).then(function(response) {
101 if (response.status == 200) {
102 return response.data;
104 return $q.reject(response.data);
106 return response.data;
108 }, function(response) {
109 // something went wrong
110 return $q.reject(response.data);