File size: 535 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { createSlice } from '@reduxjs/toolkit';
import { getItemFromLocalStorage } from '../../helper/localStorage';

const initialState = {
   currentPostData: getItemFromLocalStorage('postDataToManage') || null,
};

const currentPostSlice = createSlice({
   name: 'currentPost',
   initialState,
   reducers: {
      setCurrentPostData: (state, action) => {
         state.currentPostData = action.payload;
      },
   },
});

export const { setCurrentPostData } = currentPostSlice.actions;

export default currentPostSlice.reducer;