Skip to content

Commit ad544a1

Browse files
author
Bernabe
committed
remove react router dependency and add support to react-router v4
1 parent 6fd17b2 commit ad544a1

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
"webpack": "2.2.1"
5252
},
5353
"dependencies": {
54-
"localforage": "^1.4.0 || ^1.5.0",
55-
"react-router": "^2.3.0 || ^3.0.0"
54+
"localforage": "^1.4.0 || ^1.5.0"
5655
},
5756
"peerDependencies": {
5857
"react": "^0.14.0 || ^15.0.0",

redux-react-session-1.0.8.tgz

39.1 KB
Binary file not shown.

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as constant from './constants';
22
import * as localForage from 'localforage';
3-
import { browserHistory } from 'react-router';
43
import {
54
getSessionSuccess,
65
getSessionError,
@@ -90,7 +89,6 @@ export class sessionService {
9089
static deleteSession() {
9190
return localForage.removeItem(constant.USER_SESSION).then(() => {
9291
instance.store.dispatch(getSessionError());
93-
browserHistory.replace(instance.redirectPath);
9492
}).catch(err => err);
9593
}
9694

src/reducer.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,25 @@ import {
77

88
export const initialState = {
99
authenticated: false,
10+
checked: false,
1011
user: {}
1112
};
1213

1314
const reducer = (state = initialState, action) => {
1415
switch (action.type) {
1516
case GET_SESSION_SUCCESS: {
16-
return { user: { ...state.user }, authenticated: true };
17+
return {
18+
user: { ...state.user },
19+
authenticated: true,
20+
checked: true
21+
};
1722
}
1823
case GET_SESSION_ERROR: {
19-
return { user: { ...state.user }, authenticated: false };
24+
return {
25+
user: { ...state.user },
26+
authenticated: false,
27+
checked: true
28+
};
2029
}
2130
case GET_USER_SESSION_SUCCESS: {
2231
return { ...state, user: action.user };

0 commit comments

Comments
 (0)