blob: 8c652ffc3fc010b242daa05ec0d7dafdccc31a2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import * as types from 'app/types'
import { getDefault } from 'app/session'
const initialState = {
logged_in: !!getDefault('access_token', false),
user: {},
}
export default function authReducer(state = initialState, action) {
// console.log(action.type, action)
switch (action.type) {
case types.auth.logged_in:
return {
...state,
logged_in: true,
user: action.user,
}
case types.auth.logged_out:
return {
...state,
logged_in: false,
user: {},
}
default:
return state
}
}
|