Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 33x 33x 104x 104x 104x 291x 291x 291x 33x | import { ObjectClassEnum } from "@/api/apiStore.gen";
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
interface ClickObject {
type: ObjectClassEnum | null;
id: number | null;
clicked: boolean;
}
const initialState: ClickObject = {
type: null,
id: null,
clicked: false,
};
const detectClickSlice = createSlice({
name: "click",
initialState,
reducers: {
setClick: (
state,
action: PayloadAction<{ type: ObjectClassEnum; id: number }>,
) => {
state.type = action.payload.type;
state.id = action.payload.id;
state.clicked = true;
},
resetClick: (state) => {
state.type = null;
state.id = null;
state.clicked = false;
},
},
});
export const { setClick, resetClick } = detectClickSlice.actions;
export default detectClickSlice.reducer;
|