Move theme setting to settings store

This commit is contained in:
Thomas Nordquist
2019-04-03 02:14:09 +02:00
parent 6f86a8d471
commit b9eb54dd20
5 changed files with 31 additions and 23 deletions

View File

@@ -11,6 +11,7 @@ import {
ActionTypes,
SettingsState,
TopicOrder,
Action,
} from '../reducers/Settings'
import { Base64Message } from '../../../backend/src/Model/Base64Message';
@@ -152,3 +153,10 @@ function autoExpandLimitForTree(tree: q.Tree<TopicViewModel>) {
return closestExistingLimit(calculatedLimit)
}
export const toggleTheme = () => (dispatch: Dispatch<any>, getState: () => AppState) => {
dispatch({
type: getState().settings.theme === 'light' ? ActionTypes.SETTINGS_SET_THEME_DARK : ActionTypes.SETTINGS_SET_THEME_LIGHT,
})
dispatch(storeSettings())
}