@@ -4,7 +4,8 @@ angular.module('predicsis.jsSDK.helpers', []);
4
4
angular
5
5
. module ( 'predicsis.jsSDK' , [ 'predicsis.jsSDK.models' , 'predicsis.jsSDK.helpers' , 'restangular' ] )
6
6
. provider ( 'predicsisAPI' , function ( ) {
7
- var errorHandler = function ( response ) { throw Error ( response ) ; }
7
+ 'use strict' ;
8
+ var errorHandler = function ( response ) { throw Error ( response ) ; } ;
8
9
var baseURL = 'https://api.predicsis.com' ;
9
10
var oauthToken = 'no-token-defined' ;
10
11
@@ -18,13 +19,15 @@ angular
18
19
this . setErrorHandler = function ( handler ) { errorHandler = handler ; } ;
19
20
20
21
this . $get = function ( Restangular ,
21
- Datasets , Dictionaries , Jobs , Modalities , Models , OauthTokens , OauthApplications , PreparationRules , Projects , Reports , UserSettings , Sources , Uploads , Users , Variables ,
22
+ Datasets , Dictionaries , Jobs , Modalities , Models , OauthTokens , OauthApplications ,
23
+ PreparationRules , Projects , Reports , UserSettings , Sources , Uploads , Users , Variables ,
22
24
datasetHelper , jobsHelper , modelHelper , projectsHelper , s3FileHelper ) {
23
25
var self = this ;
24
26
25
27
Restangular . setBaseUrl ( this . getBaseUrl ( ) ) ;
26
28
Restangular . setDefaultHeaders ( { accept : 'application/json' , Authorization : 'Bearer ' + this . getOauthToken ( ) } ) ;
27
29
Restangular . setErrorInterceptor ( function ( response ) { errorHandler ( response ) ; } ) ;
30
+ jobsHelper . setErrorHandler ( function ( err ) { errorHandler ( err ) ; } ) ;
28
31
Restangular . addResponseInterceptor ( function ( data , operation , what , url , response ) {
29
32
//operation is one of 'getList', 'post', 'get', 'patch'
30
33
if ( [ 'getList' , 'post' , 'get' , 'patch' ] . indexOf ( operation ) > - 1 ) {
0 commit comments