@jfront/oauth-context
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.1.3](https://github.com/Jepria/jfront-oauth/compare/@jfront/oauth-context@0.1.2...@jfront/oauth-context@0.1.3) (2020-09-07) | ||
### Bug Fixes | ||
* axios removed useEffect hook ([a006f5b](https://github.com/Jepria/jfront-oauth/commit/a006f5b9c325dc1d93704fd08b1fe7684907cea8)) | ||
## [0.1.2](https://github.com/Jepria/jfront-oauth/compare/@jfront/oauth-context@0.1.1...@jfront/oauth-context@0.1.2) (2020-09-07) | ||
@@ -8,0 +19,0 @@ |
@@ -141,21 +141,19 @@ "use strict"; | ||
(0, _react.useEffect)(function () { | ||
if (configureAxios && axiosInstance && accessToken) { | ||
axiosInstance.defaults.headers["Authorization"] = "Bearer " + accessToken; | ||
axiosInstance.interceptors.response.use(function (response) { | ||
if (401 === (response == null ? void 0 : response.status)) { | ||
authorize(); | ||
} | ||
if (configureAxios && axiosInstance && accessToken) { | ||
axiosInstance.defaults.headers["Authorization"] = "Bearer " + accessToken; | ||
axiosInstance.interceptors.response.use(function (response) { | ||
if (401 === (response == null ? void 0 : response.status)) { | ||
authorize(); | ||
} | ||
return response; | ||
}, function (error) { | ||
var _error$response; | ||
return response; | ||
}, function (error) { | ||
var _error$response; | ||
if (401 === (error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status)) { | ||
authorize(); | ||
} | ||
}); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
if (401 === (error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status)) { | ||
authorize(); | ||
} | ||
}); | ||
} | ||
}, [accessToken]); | ||
return /*#__PURE__*/_react["default"].createElement(_OAuthContext.OAuthContext.Provider, { | ||
@@ -162,0 +160,0 @@ value: { |
@@ -129,21 +129,19 @@ import React, { useReducer, useEffect } from "react"; | ||
useEffect(() => { | ||
if (configureAxios && axiosInstance && accessToken) { | ||
axiosInstance.defaults.headers["Authorization"] = "Bearer " + accessToken; | ||
axiosInstance.interceptors.response.use(response => { | ||
if (401 === (response == null ? void 0 : response.status)) { | ||
authorize(); | ||
} | ||
if (configureAxios && axiosInstance && accessToken) { | ||
axiosInstance.defaults.headers["Authorization"] = "Bearer " + accessToken; | ||
axiosInstance.interceptors.response.use(response => { | ||
if (401 === (response == null ? void 0 : response.status)) { | ||
authorize(); | ||
} | ||
return response; | ||
}, error => { | ||
var _error$response; | ||
return response; | ||
}, error => { | ||
var _error$response; | ||
if (401 === (error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status)) { | ||
authorize(); | ||
} | ||
}); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
if (401 === (error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status)) { | ||
authorize(); | ||
} | ||
}); | ||
} | ||
}, [accessToken]); | ||
return /*#__PURE__*/React.createElement(OAuthContext.Provider, { | ||
@@ -150,0 +148,0 @@ value: { |
{ | ||
"name": "@jfront/oauth-context", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "Apache-2.0", | ||
@@ -40,3 +40,3 @@ "repository": "https://github.com/Jepria/jfront-oauth", | ||
}, | ||
"gitHead": "b3d8f7cbdda2a88dcff3ebd900ed6c8915dd1fa1" | ||
"gitHead": "07190351e6fee1545e4acb1fa925e0c538a655b5" | ||
} |
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
66871
517