equal
deleted
inserted
replaced
7 } |
7 } |
8 } |
8 } |
9 |
9 |
10 export const currentUser = (state = null, action) => { |
10 export const currentUser = (state = null, action) => { |
11 switch (action.type) { |
11 switch (action.type) { |
|
12 case types.AUTH_LOGOUT: |
|
13 localStorage.removeItem('currentUser'); |
|
14 return null; |
12 case types.AUTH_LOGIN_SUCCESS: |
15 case types.AUTH_LOGIN_SUCCESS: |
13 return action.user; |
16 return action.user; |
14 default: |
17 default: |
15 return state; |
18 return state; |
16 } |
19 } |
17 } |
20 } |
18 |
21 |
19 export const token = (state = null, action) => { |
22 export const token = (state = null, action) => { |
20 switch (action.type) { |
23 switch (action.type) { |
|
24 case types.AUTH_LOGOUT: |
|
25 localStorage.removeItem('token'); |
|
26 return null; |
21 case types.AUTH_STORE_TOKEN: |
27 case types.AUTH_STORE_TOKEN: |
22 return action.token; |
28 return action.token; |
23 default: |
29 default: |
24 return state; |
30 return state; |
25 } |
31 } |