mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
20 lines
456 B
JavaScript
20 lines
456 B
JavaScript
import { combineReducers } from 'redux'
|
|
import { USER_UPDATE } from './actions'
|
|
|
|
const initialCurrentUser = JSON.parse(localStorage.getItem('currentUser'))
|
|
|
|
function currentUser (state, action) {
|
|
switch (action.type) {
|
|
case USER_UPDATE:
|
|
let user = action.data
|
|
localStorage.setItem('currentUser', JSON.stringify(user))
|
|
return user
|
|
default:
|
|
return initialCurrentUser
|
|
}
|
|
}
|
|
|
|
export default combineReducers({
|
|
currentUser
|
|
})
|