farhantock
6 months ago
2 changed files with 29 additions and 0 deletions
@ -0,0 +1,12 @@
|
||||
export const SET_THEME = 'SET_THEME'; |
||||
export const SET_SYSTEM_THEME = 'SET_SYSTEM_THEME'; |
||||
|
||||
export const setTheme = (theme) => ({ |
||||
type: SET_THEME, |
||||
payload: theme, |
||||
}); |
||||
|
||||
export const setSystemTheme = (useSystemTheme) => ({ |
||||
type: SET_SYSTEM_THEME, |
||||
payload: useSystemTheme, |
||||
}); |
@ -0,0 +1,17 @@
|
||||
import { SET_THEME, SET_SYSTEM_THEME } from './actions'; |
||||
|
||||
const initialState = { |
||||
theme: '', |
||||
useSystemTheme: true, |
||||
}; |
||||
|
||||
export default function themeReducer(state = initialState, action) { |
||||
switch (action.type) { |
||||
case SET_THEME: |
||||
return { ...state, theme: action.payload } |
||||
case SET_SYSTEM_THEME: |
||||
return { ...state, useSystemTheme: action.payload } |
||||
default: |
||||
return state; |
||||
} |
||||
} |
Loading…
Reference in new issue