37 lines
980 B
TypeScript
37 lines
980 B
TypeScript
import { createSlice } from '@reduxjs/toolkit';
|
|
import { IReportee } from '../screens/allCases/interface';
|
|
import { MY_CASE_ITEM } from './userSlice';
|
|
|
|
interface IReporteesSlice {
|
|
agentsList: IReportee[];
|
|
isLoading: boolean;
|
|
showAgentSelectionBottomSheet: boolean;
|
|
}
|
|
|
|
const initialState: IReporteesSlice = {
|
|
agentsList: [],
|
|
isLoading: false,
|
|
showAgentSelectionBottomSheet: false,
|
|
};
|
|
|
|
export const userSlice = createSlice({
|
|
name: 'reportees',
|
|
initialState,
|
|
reducers: {
|
|
setReporteesList: (state, action) => {
|
|
state.agentsList = [MY_CASE_ITEM, ...(action.payload || [])];
|
|
},
|
|
setReporteesLoading: (state, action) => {
|
|
state.isLoading = action.payload;
|
|
},
|
|
setShowAgentSelectionBottomSheet: (state, action) => {
|
|
state.showAgentSelectionBottomSheet = action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setReporteesList, setReporteesLoading, setShowAgentSelectionBottomSheet } =
|
|
userSlice.actions;
|
|
|
|
export default userSlice.reducer;
|