You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| user: ||`object` containing current user informations |
118
+
| -- loading | false |`bool` is user currently loaded from the server |
119
+
| -- logged | false |`bool` is the current user logged in (setted by [`config.isUserLogged`](#configisuserloggeduser-async)) |
120
+
| -- ... | null |`any` informations about the user sent by the server (setted by [`config.getUser`](#configgetuser-async))|
121
121
122
122
```js
123
123
import { withUser } from'react-authmanager';
@@ -138,7 +138,7 @@ class MyComponent extends React.Component {
138
138
## 4 - Secure components
139
139
**withGuard** HOC helps you protect your components in a flexible way. By example, you can render a login form instead of a component if no user is logged in.<br/>
140
140
It needs a guard as parameter. A guard is just a function that returns a component, so you can easily create your own guards.<br/>
Get an authentication token when an user tries to login. `getToken` is called when the auth login function is executed to store the token in *localStorage*.
Define if the current user (returned by `getUser`) is logged. `isUserLogged` is called after each user state change. The result is set in `user.logged`.
230
230
231
231
**Parameters**
@@ -259,7 +259,7 @@ import Authmanager from 'react-authmanager';
259
259
constAuthmanager.utils.getToken()
260
260
```
261
261
262
-
### `getToken()`
262
+
### `utils.getToken()`
263
263
Returns the current stored token (in *localStorage*). You should use `getToken` to authorize your requests to the server
0 commit comments