Skip to content

Commit

Permalink
fix: remove data prop for now from modal slice
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneMoroz committed Sep 23, 2023
1 parent 243e0ae commit b38f0b5
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/store/features/modal/modalSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@ import { PayloadAction, createSlice } from "@reduxjs/toolkit";

export type ModalType = "example1" | "example2";

interface ModalData {
data?: {};
}

interface ModalState {
type: ModalType | null;
data: ModalData;
isOpen: boolean;
}

const initialState: ModalState = {
type: null,
data: {},
isOpen: false,
};

export const modalSlice = createSlice({
name: "modal",
initialState,
reducers: {
onOpen: (state, action: PayloadAction<{ type: ModalType; data?: any }>) => {
onOpen: (state, action: PayloadAction<{ type: ModalType }>) => {
state.isOpen = true;
state.type = action.payload.type;
state.data = action.payload.data || null;
},
onClose: (state) => {
state.isOpen = false;
Expand Down

0 comments on commit b38f0b5

Please sign in to comment.