Skip to content

Commit

Permalink
add settings control
Browse files Browse the repository at this point in the history
  • Loading branch information
nvcnvn committed Nov 24, 2014
1 parent 5d7575f commit eca3e23
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,65 @@ kidstuff.auth.module.provider('auth',function() {
});
}


auth.updateSettings = function(settings, success, error) {
if(typeof settings != "object") {
return
}

$http({
method: 'PATCH',
url: config.endPoint+'/settings',
headers: {Authorization: 'Bearer '+localStorageService.get('access_token')},
data: settings
}).
success(function(data, status, headers, config) {
if(typeof success == 'function') {
success();
}
}).
error(function(data, status, headers, config) {
if(typeof error == 'function') {
error(data);
}
});
}

auth.getSettings = function(keys, success, error) {
$http({
method: 'GET',
url: config.endPoint+'/settings?keys='+keys.toString(),
headers: {Authorization: 'Bearer '+localStorageService.get('access_token')}
}).
success(function(data, status, headers, config) {
if(typeof success == 'function') {
success(data);
}
}).
error(function(data, status, headers, config) {
if(typeof error == 'function') {
error(data);
}
});
}

auth.removeSettings = function(keys, success, error) {
$http({
method: 'DELETE',
url: config.endPoint+'/settings?keys='+keys.toString(),
headers: {Authorization: 'Bearer '+localStorageService.get('access_token')}
}).
success(function(data, status, headers, config) {
if(typeof success == 'function') {
success();
}
}).
error(function(data, status, headers, config) {
if(typeof error == 'function') {
error(data);
}
});
}
return auth;
}];

Expand Down

0 comments on commit eca3e23

Please sign in to comment.