@@ -333,6 +333,65 @@ kidstuff.auth.module.provider('auth',function() {
333
333
} ) ;
334
334
}
335
335
336
+
337
+ auth . updateSettings = function ( settings , success , error ) {
338
+ if ( typeof settings != "object" ) {
339
+ return
340
+ }
341
+
342
+ $http ( {
343
+ method : 'PATCH' ,
344
+ url : config . endPoint + '/settings' ,
345
+ headers : { Authorization : 'Bearer ' + localStorageService . get ( 'access_token' ) } ,
346
+ data : settings
347
+ } ) .
348
+ success ( function ( data , status , headers , config ) {
349
+ if ( typeof success == 'function' ) {
350
+ success ( ) ;
351
+ }
352
+ } ) .
353
+ error ( function ( data , status , headers , config ) {
354
+ if ( typeof error == 'function' ) {
355
+ error ( data ) ;
356
+ }
357
+ } ) ;
358
+ }
359
+
360
+ auth . getSettings = function ( keys , success , error ) {
361
+ $http ( {
362
+ method : 'GET' ,
363
+ url : config . endPoint + '/settings?keys=' + keys . toString ( ) ,
364
+ headers : { Authorization : 'Bearer ' + localStorageService . get ( 'access_token' ) }
365
+ } ) .
366
+ success ( function ( data , status , headers , config ) {
367
+ if ( typeof success == 'function' ) {
368
+ success ( data ) ;
369
+ }
370
+ } ) .
371
+ error ( function ( data , status , headers , config ) {
372
+ if ( typeof error == 'function' ) {
373
+ error ( data ) ;
374
+ }
375
+ } ) ;
376
+ }
377
+
378
+ auth . removeSettings = function ( keys , success , error ) {
379
+ $http ( {
380
+ method : 'DELETE' ,
381
+ url : config . endPoint + '/settings?keys=' + keys . toString ( ) ,
382
+ headers : { Authorization : 'Bearer ' + localStorageService . get ( 'access_token' ) }
383
+ } ) .
384
+ success ( function ( data , status , headers , config ) {
385
+ if ( typeof success == 'function' ) {
386
+ success ( ) ;
387
+ }
388
+ } ) .
389
+ error ( function ( data , status , headers , config ) {
390
+ if ( typeof error == 'function' ) {
391
+ error ( data ) ;
392
+ }
393
+ } ) ;
394
+ }
336
395
return auth ;
337
396
} ] ;
338
397
0 commit comments