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
Force to refresh the Redux Store from the localStorage.
@@ -91,8 +97,10 @@ export default (
91
97
92
98
Note: If you're using react-router v4 this function it's not necessary. Check out the [react-router-v4-example](https://github.com/bernabe9/redux-react-session/tree/master/examples/react-router-v4-example)
93
99
100
+
Note: This function could be used in the client side as well as the server side.
101
+
94
102
### saveSession(session:object) : Promise
95
-
Saves the session object in the localStorage and changes the `authenticated` flag to `true` in Redux Store
103
+
Saves the session object in the storage/cookies and changes the `authenticated` flag to `true` in Redux Store
96
104
97
105
### loadSession : Promise(currentSession:Object)
98
106
Returns the current session if exists
@@ -105,21 +113,21 @@ loadSession
105
113
```
106
114
107
115
### deleteSession : Promise
108
-
Deletes the current session
116
+
Deletes the current session from the storage/cookies
109
117
110
118
### saveUser(user:object) : Promise
111
-
Saves the user object in the localStorage and in the Redux Store
119
+
Saves the user object in the storage/cookies and in the Redux Store
112
120
113
121
### loadUser : Promise
114
122
Returns the current user if exists
115
123
116
124
### deleteUser : Promise
117
-
Deletes the current user
125
+
Deletes the current user from the storage/cookies
118
126
119
127
## Server Rendering
120
128
`redux-react-session` also provides methods to keep the session with server rendering using cookies. So the session will work on the server side as well as the client side.
Initialize an instance of the client session service, IMPORTANT to set the option 'COOKIES'(this is the way that the client send the session data to the server).
141
149
142
150
This function is used in the `client.js` of the server rendering to initialize a session service instance.
143
151
```javascript
@@ -147,27 +155,5 @@ import { sessionService } from 'redux-react-session';
147
155
148
156
conststore=createStore(reducer)
149
157
150
-
sessionService.initClientSession(store);
151
-
```
152
-
153
-
### checkAuthServer
154
-
Authorization function for [react-router](https://github.com/ReactTraining/react-router) to restrict routes, it checks if exist a session and redirects to the `redirectPath`.
155
-
156
-
The difference between `checkAuthServer` and `checkAuth` is that the first one is used in the server side and check the authorization with the cookies in the request.
0 commit comments