Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eduzz/accounts-react-wrapper

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eduzz/accounts-react-wrapper - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 1.1.0 (08 de Março de 2022)
- Adicionando a feature: inicialização de interceptors para o axios.
## 1.0.0 (02 de Março de 2022)

@@ -2,0 +6,0 @@

8

package.json
{
"name": "@eduzz/accounts-react-wrapper",
"version": "1.0.0",
"version": "1.1.0",
"main": "./lib/cjs/index.js",

@@ -37,2 +37,4 @@ "module": "./lib/esm/index.js",

"jsonwebtoken": "^8",
"react": "^16",
"react-dom": "^16",
"react-scripts": "4.0.3",

@@ -42,5 +44,3 @@ "react-test-renderer": "^17.0.2",

"typescript": "^4.4",
"web-vitals": "^1.0.1",
"react": "^16",
"react-dom": "^16"
"web-vitals": "^1.0.1"
},

@@ -47,0 +47,0 @@ "peerDependencies": {

@@ -210,2 +210,49 @@ # Eduzz Accounts React Wrapper

### [4. Inicializar interceptors](#inicializar-interceptors)
```jsx
import { Apis } from 'web/services/api'
import { useAuth } from '@eduzz/accounts-react-wrapper';
type ExapledBearerTokenDecoded = {
name: string;
email: string;
}
function App() {
const { bearerTokenDecoded, loading, bearerToken, logout, interceptors } = useAuth<ExapledBearerTokenDecoded>();
function tryInitializeInterceptors() {
if (bearerTokenDecoded?.exp) {
interceptors?.axios.initialize({
interceptors: Apis.produtoFisicoApi.instance.interceptors,
active: { // não obrigatório
addBearerOnAllRequests: true, // default
logoutWhenResponseIsUnauthorized: true, // default
refreshWhenBearerTokenIsExpired: true, // default
}
});
}
}
useEffect(()=>{
tryInitializeInterceptors();
},[bearerToken])
return (
<div className='App'>
<header className='App-header'>
<div className="App">
<p>user name: {bearerTokenDecoded?.name}</p>
<p>user email: {bearerTokenDecoded?.email}</p>
<p>bearerToken: {bearerToken}</p>
<p>loading: {loading}</p>
<button onClick={logout}>Logout</button>
</div>
</header>
</div>
)
}
```
---

@@ -212,0 +259,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc