1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-20 21:21:59 +00:00

set app status

This commit is contained in:
Rokt33r
2015-10-13 02:49:59 +09:00
parent cd94c625a7
commit 5356e68b51
4 changed files with 50 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
import { combineReducers } from 'redux'
import { PARAMS_CHANGE, USER_UPDATE } from './actions'
import { SWITCH_USER, SWITCH_FOLDER, USER_UPDATE } from './actions'
const initialCurrentUser = JSON.parse(localStorage.getItem('currentUser'))
const initialParams = {}
@@ -16,10 +16,16 @@ function currentUser (state, action) {
}
}
function params (state, action) {
function status (state, action) {
switch (action.type) {
case PARAMS_CHANGE:
return action.data
case SWITCH_USER:
state.userId = action.data
console.log(action)
state.folderId = null
return state
case SWITCH_FOLDER:
state.folderId = action.data
return state
default:
if (state == null) return initialParams
return state
@@ -28,5 +34,5 @@ function params (state, action) {
export default combineReducers({
currentUser,
params
status
})