mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-10 14:33:11 +08:00
22 lines
460 B
TypeScript
22 lines
460 B
TypeScript
import { ActionTypes, Action } from '../actions';
|
|
|
|
export interface State {
|
|
theme: string;
|
|
}
|
|
|
|
const initialState: State = {
|
|
theme: 'blues'
|
|
}
|
|
|
|
const setTheme = (state: State, action: Action): State => {
|
|
return { theme: action.payload };
|
|
}
|
|
|
|
const themeReducer = (state = initialState, action: Action) => {
|
|
switch (action.type) {
|
|
case ActionTypes.setTheme: return setTheme(state, action);
|
|
default: return state;
|
|
}
|
|
}
|
|
|
|
export default themeReducer; |