OwlcodeAds/js-src/slice/is-mobile.ts
2023-08-05 09:22:04 +02:00

24 lines
521 B
TypeScript

import type { PayloadAction } from '@reduxjs/toolkit'
import { createSlice } from '@reduxjs/toolkit'
interface StateType {
value: boolean | null
}
const initialValue: StateType = {
value: null
}
export const isMobileSlice = createSlice({
name: 'menu-open',
initialState: initialValue,
reducers: {
set: (state, action: PayloadAction<boolean>) => {
state.value = action.payload
}
}
})
export const { set } = isMobileSlice.actions
export default isMobileSlice.reducer