27 lines
568 B
TypeScript
27 lines
568 B
TypeScript
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
import { RootState } from '../store';
|
|
|
|
interface HeaderState {
|
|
showInput: boolean;
|
|
}
|
|
|
|
const initialState: HeaderState = {
|
|
showInput: false,
|
|
};
|
|
|
|
const headerSlice = createSlice({
|
|
name: 'header',
|
|
initialState,
|
|
reducers: {
|
|
setShowInput(state, action: PayloadAction<boolean>) {
|
|
state.showInput = action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const selectHeader = (state: RootState) => state.headerSlice;
|
|
|
|
export const { setShowInput } = headerSlice.actions;
|
|
|
|
export default headerSlice.reducer;
|