25 lines
641 B
TypeScript
25 lines
641 B
TypeScript
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
export const appSlice = createSlice({
|
|
name: "app",
|
|
initialState: {
|
|
darkMode: false,
|
|
userAuthenticated: null,
|
|
},
|
|
reducers: {
|
|
setDarkMode: (state, action) => {
|
|
state.darkMode = action.payload;
|
|
},
|
|
setUserAuthenticated: (state, action) => {
|
|
state.userAuthenticated = action.payload;
|
|
}
|
|
},
|
|
selectors: {
|
|
darkMode: (state) => state.darkMode,
|
|
userAuthenticated: (state) => state.userAuthenticated,
|
|
},
|
|
})
|
|
|
|
export const { setDarkMode, setUserAuthenticated } = appSlice.actions;
|
|
|
|
export const { darkMode, userAuthenticated } = appSlice.selectors; |