@@ -52,37 +52,37 @@ export default class HttpClient {
5252 variables : any
5353 ) {
5454 const self = this
55- return function ( ) : Promise < any > {
55+ return function ( ) : Promise < any > {
5656 return Promise . resolve ( ) //
57- . then ( function ( ) {
57+ . then ( function ( ) {
5858 if ( ! process . env . REACT_APP_IS_DEBUG ) {
5959 return Promise . resolve ( )
6060 }
61- return new Promise < void > ( function ( res ) {
61+ return new Promise < void > ( function ( res ) {
6262 setTimeout ( res , 500 )
6363 } )
6464 } )
65- . then ( function ( ) {
65+ . then ( function ( ) {
6666 return self . fetchInternal ( method , endpoint , variables ) //
6767 } )
68- . then ( function ( data ) {
68+ . then ( function ( data ) {
6969 if (
7070 data . status === ErrorFactory . STATUS_AUTH_TOKEN_INVALID
7171 ) {
7272 return self
7373 . onAuthFailure ( ) //
74- . then ( function ( ) {
74+ . then ( function ( ) {
7575 return self
7676 . fetchInternal ( method , endpoint , variables )
77- . then ( function ( newRequestResponse ) {
77+ . then ( function ( newRequestResponse ) {
7878 return newRequestResponse
7979 } )
8080 } )
8181 } else {
8282 return data
8383 }
8484 } )
85- . then ( function ( data ) {
85+ . then ( function ( data ) {
8686 if (
8787 data . status !== ErrorFactory . OKAY &&
8888 data . status !== ErrorFactory . OKAY_BUILD_STARTED
@@ -94,25 +94,25 @@ export default class HttpClient {
9494 }
9595 return data
9696 } )
97- . then ( function ( data ) {
97+ . then ( function ( data ) {
9898 // tslint:disable-next-line: max-line-length
9999 // These two blocks are clearly memory leaks! But I don't have time to fix them now... I need to CANCEL the promise, but since I don't
100100 // have CANCEL method on the native Promise, I return a promise that will never RETURN if the HttpClient is destroyed.
101101 // tslint:disable-next-line: max-line-length
102102 // Will fix them later... but it shouldn't be a big deal anyways as it's only a problem when user navigates away from a page before the
103103 // network request returns back.
104- return new Promise ( function ( resolve , reject ) {
104+ return new Promise ( function ( resolve , reject ) {
105105 // data.data here is the "data" field inside the API response! {status: 100, description: "Login succeeded", data: {…}}
106106 if ( ! self . isDestroyed ) {
107107 return resolve ( data . data )
108108 }
109109 Logger . dev ( 'Destroyed then not called' )
110110 } )
111111 } )
112- . catch ( function ( error ) {
112+ . catch ( function ( error ) {
113113 // Logger.log('');
114114 // Logger.error(error.message || error);
115- return new Promise ( function ( resolve , reject ) {
115+ return new Promise ( function ( resolve , reject ) {
116116 if ( ! self . isDestroyed ) {
117117 return reject ( error )
118118 }
@@ -145,7 +145,7 @@ export default class HttpClient {
145145 headers : self . createHeaders ( ) ,
146146 qs : variables ,
147147 json : true
148- } ) . then ( function ( data ) {
148+ } ) . then ( function ( data ) {
149149 return data
150150 } )
151151 }
@@ -162,7 +162,7 @@ export default class HttpClient {
162162 headers : self . createHeaders ( ) ,
163163 formData : variables ,
164164 json : true
165- } ) . then ( function ( data ) {
165+ } ) . then ( function ( data ) {
166166 return data
167167 } )
168168 }
@@ -171,7 +171,7 @@ export default class HttpClient {
171171 headers : self . createHeaders ( ) ,
172172 body : variables ,
173173 json : true
174- } ) . then ( function ( data ) {
174+ } ) . then ( function ( data ) {
175175 return data
176176 } )
177177 }
0 commit comments