Clean store fields, move from state.ui to state.app those that make sense

This commit is contained in:
Franc Camps-Febrer
2018-12-06 13:16:40 +00:00
parent fe6922d8fb
commit 89a7290dbf
14 changed files with 90 additions and 119 deletions

View File

@@ -1,55 +1,9 @@
import initial from '../store/initial.js';
import {
TOGGLE_FETCHING_DOMAIN,
TOGGLE_FETCHING_SOURCES,
TOGGLE_VIEW,
TOGGLE_TIMELINE,
TOGGLE_INFOPOPUP,
TOGGLE_NOTIFICATIONS
} from '../actions'
function toggleFetchingDomain(uiState, action) {
return {
...uiState,
flags: {
...uiState.flags,
isFetchingDomain: !uiState.flags.isFetchingDomain
}
}
}
function toggleFetchingSources(uiState, action) {
return {
...uiState,
flags: {
...uiState.flags,
isFetchingSources: !uiState.flags.isFetchingSources
}
}
}
function toggleInfoPopup(uiState, action) {
return {
...uiState,
flags: {
...uiState.flags,
isInfopopup: !uiState.flags.isInfopopup
}
}
}
import {} from '../actions'
function ui(uiState = initial.ui, action) {
switch (action.type) {
case TOGGLE_FETCHING_DOMAIN:
return toggleFetchingDomain(uiState, action)
case TOGGLE_FETCHING_SOURCES:
return toggleFetchingSources(uiState, action)
case TOGGLE_INFOPOPUP:
return toggleInfoPopup(uiState, action)
default:
return uiState
}
return uiState;
}
export default ui;