Blame view
app/partials/accountSetting/accountSetting.Service.js
4.12 KB
f746aee1b
|
1 2 3 4 5 6 |
(function() { 'use strict'; angular.module('acufuel').service( 'AccountSettingService', [ '$rootScope', '$q', '$http', '$state', 'BASE_URL', AccountSettingService ]); |
3a9f4472b
|
7 |
|
f746aee1b
|
8 |
function AccountSettingService($rootScope, $q, $http, $state, BASE_URL) { |
3a9f4472b
|
9 |
|
f746aee1b
|
10 |
this.getProducts = function() { |
3a9f4472b
|
11 |
|
f746aee1b
|
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
var deferred = $q.defer(); $http({ method : 'GET', url : BASE_URL.url + '/user/products', headers : { 'Content-Type' : 'application/json' }, }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
3a9f4472b
|
27 |
|
f746aee1b
|
28 |
this.updateProducts = function(data) { |
bb639860c
|
29 |
|
f746aee1b
|
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
var deferred = $q.defer(); $http({ method : 'PUT', url : BASE_URL.url + '/fuelPricing/product', data : data, headers : { 'Content-Type' : 'application/json' }, }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
bb639860c
|
46 |
|
f746aee1b
|
47 |
this.loginUserData = function(id) { |
bb639860c
|
48 |
|
f746aee1b
|
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
var deferred = $q.defer(); $http({ method : 'GET', url : BASE_URL.url + '/account/user/' + id, headers : { 'Content-Type' : 'application/json' }, }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
3e6e9e0f4
|
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
this.checkEmail = function(email) { var deferred = $q.defer(); $http({ method : 'GET', url : BASE_URL.url + '/user/email/status?email=' + email, headers : { 'Content-Type' : 'application/json' }, }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
f746aee1b
|
82 83 |
this.updateUserProfile = function(data) { |
bb639860c
|
84 |
|
f746aee1b
|
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
var deferred = $q.defer(); $http({ method : 'PUT', url : BASE_URL.url + '/account/updateProfile', headers : { 'Content-Type' : 'application/x-www-form-urlencoded' }, data : data }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
bb639860c
|
101 |
|
f746aee1b
|
102 103 104 105 106 107 108 109 110 111 112 113 114 |
this.addAdditionalAccount = function(data) { console.log('----$scope.accountdata--', data); var deferred = $q.defer(); $http({ method : 'POST', url : BASE_URL.url + '/additionalAccount', headers : { 'Content-Type' : 'application/json' }, data : data }).then(function(result) { deferred.resolve(result.data); }, function(result) { |
f746aee1b
|
115 116 117 118 119 120 121 |
deferred.resolve(result.data); }) return deferred.promise; } this.getAdditionalAccounts = function() { |
bb639860c
|
122 123 |
var deferred = $q.defer(); $http({ |
f746aee1b
|
124 125 126 |
method : 'GET', url : BASE_URL.url +'/user/additionalAccount', headers : {'Content-Type': 'application/json'}, |
bb639860c
|
127 128 129 130 131 132 133 134 135 |
}) .then(function (result){ deferred.resolve(result.data); },function (result){ //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
f746aee1b
|
136 137 |
this.updateStatus = function(data) { |
bb639860c
|
138 |
|
f746aee1b
|
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
var deferred = $q.defer(); $http({ method : 'PUT', url : BASE_URL.url + '/additionalAccount', headers : { 'Content-Type' : 'application/x-www-form-urlencoded' }, data : data }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } this.deleteAccount = function(id) { |
ae523d5ef
|
157 |
|
f746aee1b
|
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
var deferred = $q.defer(); $http({ method : 'DELETE', url : BASE_URL.url + '/additionalAccount/'+id, headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } }).then(function(result) { deferred.resolve(result.data); }, function(result) { //console.log(result.data) deferred.resolve(result.data); }) return deferred.promise; } |
ae523d5ef
|
173 |
|
f746aee1b
|
174 |
} |
ae523d5ef
|
175 |
|
3a9f4472b
|
176 |
})(); |