fulcrum-app
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -119,2 +119,7 @@ 'use strict'; | ||
}, { | ||
key: 'registerAuthenticationErrorHandler', | ||
value: function registerAuthenticationErrorHandler(func) { | ||
this.api.registerAuthenticationErrorHandler(func); | ||
} | ||
}, { | ||
key: 'forms', | ||
@@ -121,0 +126,0 @@ get: function get() { |
@@ -95,3 +95,3 @@ 'use strict'; | ||
if (resp.ok) { | ||
_context.next = 6; | ||
_context.next = 7; | ||
break; | ||
@@ -101,9 +101,15 @@ } | ||
errorMessage = errorMessageForStatus(resp.status) || 'Unknown Error'; | ||
if (errorMessage === 'Unauthorized' && this.authenticationErrorHandler) { | ||
this.authenticationErrorHandler(); | ||
} | ||
throw new Error(errorMessage); | ||
case 6: | ||
case 7: | ||
contentType = resp.headers.get('Content-Type'); | ||
if (!(contentType && contentType.split(';')[0] === 'application/json')) { | ||
_context.next = 9; | ||
_context.next = 10; | ||
break; | ||
@@ -114,6 +120,6 @@ } | ||
case 9: | ||
case 10: | ||
return _context.abrupt('return', resp.text()); | ||
case 10: | ||
case 11: | ||
case 'end': | ||
@@ -173,2 +179,7 @@ return _context.stop(); | ||
} | ||
}, { | ||
key: 'registerAuthenticationErrorHandler', | ||
value: function registerAuthenticationErrorHandler(func) { | ||
this.authenticationErrorHandler = func; | ||
} | ||
}]); | ||
@@ -175,0 +186,0 @@ return Fetcher; |
{ | ||
"name": "fulcrum-app", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "JavaScript wrapper for the Fulcrum API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -156,2 +156,6 @@ import Fetcher from './fetcher'; | ||
} | ||
registerAuthenticationErrorHandler(func) { | ||
this.api.registerAuthenticationErrorHandler(func); | ||
} | ||
} |
@@ -60,2 +60,7 @@ function getQueryString(params) { | ||
const errorMessage = errorMessageForStatus(resp.status) || 'Unknown Error'; | ||
if (errorMessage === 'Unauthorized' && this.authenticationErrorHandler) { | ||
this.authenticationErrorHandler(); | ||
} | ||
throw new Error(errorMessage); | ||
@@ -109,2 +114,6 @@ } | ||
} | ||
registerAuthenticationErrorHandler(func) { | ||
this.authenticationErrorHandler = func; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170000
3101