Update syntax + var names + patterns to convention

pull/1265/head
Jared Scheib 2017-04-17 11:24:18 -07:00
parent 72883c066f
commit acc8edf360
5 changed files with 22 additions and 12 deletions

View File

@ -12,11 +12,11 @@ const initialState = {
}
const {
ephemeral: initialEphemeralState,
persisted: initialPersistedState,
ephemeral: initialAppEphemeralState,
persisted: initialAppPersistedState,
} = initialState
const ephemeralReducer = (state = initialEphemeralState, action) => {
const appEphemeralReducer = (state = initialAppEphemeralState, action) => {
switch (action.type) {
case 'ENABLE_PRESENTATION_MODE': {
return {
@ -37,7 +37,7 @@ const ephemeralReducer = (state = initialEphemeralState, action) => {
}
}
const persistedReducer = (state = initialPersistedState, action) => {
const appPersistedReducer = (state = initialAppPersistedState, action) => {
switch (action.type) {
case 'SET_AUTOREFRESH': {
return {
@ -51,7 +51,9 @@ const persistedReducer = (state = initialPersistedState, action) => {
}
}
export default combineReducers({
ephemeral: ephemeralReducer,
persisted: persistedReducer,
const appReducer = combineReducers({
ephemeral: appEphemeralReducer,
persisted: appPersistedReducer,
})
export default appReducer

View File

@ -31,7 +31,7 @@ const authReducer = (state = initialState, action) => {
return {...state, me, isMeLoading: false}
}
case 'LOGOUT': {
return {}
return {...initialState}
}
}

View File

@ -4,7 +4,7 @@ const getInitialState = () => ({
const initialState = getInitialState()
const errors = (state = initialState, action) => {
const errorsReducer = (state = initialState, action) => {
switch (action.type) {
case 'ERROR_THROWN': {
return {...action.error}
@ -14,4 +14,4 @@ const errors = (state = initialState, action) => {
return state
}
export default errors
export default errorsReducer

View File

@ -5,7 +5,7 @@ function getInitialState() {
}
const initialState = getInitialState()
export default function notifications(state = initialState, action) {
const notificationsReducer = (state = initialState, action) => {
switch (action.type) {
case 'NOTIFICATION_RECEIVED': {
const {type, message} = action.payload
@ -22,3 +22,5 @@ export default function notifications(state = initialState, action) {
return state
}
export default notificationsReducer

View File

@ -1,4 +1,8 @@
export default function sources(state = [], action) {
const getInitialState = () => []
const initialState = getInitialState()
const sourcesReducer = (state = initialState, action) => {
switch (action.type) {
case 'LOAD_SOURCES': {
return action.payload.sources
@ -25,3 +29,5 @@ export default function sources(state = [], action) {
return state
}
export default sourcesReducer