mirror of
https://github.com/pawelmalak/flame.git
synced 2025-08-07 03:35:18 +02:00
Added redux. Moved theme loading/setting to redux actions. Added automatic theme loading based on localStorage value.
This commit is contained in:
parent
765418d3d2
commit
7199e296b8
14 changed files with 203 additions and 39 deletions
9
client/src/store/reducers/index.ts
Normal file
9
client/src/store/reducers/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { combineReducers } from 'redux';
|
||||
|
||||
import themeReducer from './theme';
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
theme: themeReducer
|
||||
})
|
||||
|
||||
export default rootReducer;
|
18
client/src/store/reducers/theme.ts
Normal file
18
client/src/store/reducers/theme.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { SET_THEME } from '../actions/actionTypes';
|
||||
|
||||
const initialState = {
|
||||
theme: 'blues'
|
||||
}
|
||||
|
||||
const themeReducer = (state = initialState, action: any) => {
|
||||
switch (action.type) {
|
||||
case SET_THEME:
|
||||
return {
|
||||
theme: action.payload
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export default themeReducer;
|
Loading…
Add table
Add a link
Reference in a new issue