2024-02-02 01:40:28 -05:00
|
|
|
import { createSlice } from '@reduxjs/toolkit'
|
|
|
|
|
|
|
|
export const tableBarItemSlice = createSlice({
|
|
|
|
name: 'tableBarItem',
|
|
|
|
initialState: {
|
|
|
|
type:"tableBarItem",
|
2024-02-03 20:29:00 -05:00
|
|
|
data: [],
|
|
|
|
activeKey:""
|
2024-02-02 01:40:28 -05:00
|
|
|
},
|
|
|
|
reducers: {
|
2024-02-03 20:29:00 -05:00
|
|
|
addTableBarItem: (state, action) => {
|
|
|
|
console.log("tableBarItemSlice:tableBarItem=====", state, action,)
|
|
|
|
if (state.data.filter(file=>file.key===action.payload.key).length===0){
|
|
|
|
state.data.push(action.payload)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setActiveKey:(state,action)=>{
|
|
|
|
if (state.activeKey!==action.payload){
|
|
|
|
state.activeKey=action.payload;
|
|
|
|
}
|
2024-02-02 01:40:28 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2024-02-03 20:29:00 -05:00
|
|
|
export const { addTableBarItem,setActiveKey } = tableBarItemSlice.actions
|
2024-02-02 01:40:28 -05:00
|
|
|
export default tableBarItemSlice.reducer
|