mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
26 lines
594 B
JavaScript
26 lines
594 B
JavaScript
import { createSlice } from '@reduxjs/toolkit';
|
|
import { getItem } from 'lib/web';
|
|
import { LOCALE_CONFIG, THEME_CONFIG } from 'lib/constants';
|
|
|
|
const app = createSlice({
|
|
name: 'app',
|
|
initialState: {
|
|
locale: getItem(LOCALE_CONFIG) || 'en-US',
|
|
theme: getItem(THEME_CONFIG) || 'light',
|
|
},
|
|
reducers: {
|
|
setLocale(state, action) {
|
|
state.locale = action.payload;
|
|
return state;
|
|
},
|
|
setTheme(state, action) {
|
|
state.theme = action.payload;
|
|
return state;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setLocale, setTheme } = app.actions;
|
|
|
|
export default app.reducer;
|