import type { Action } from 'easy-peasy'; import { action } from 'easy-peasy'; interface AdminAllocationStore { selectedAllocations: number[]; setSelectedAllocations: Action; appendSelectedAllocation: Action; removeSelectedAllocation: Action; } const allocations: AdminAllocationStore = { selectedAllocations: [], setSelectedAllocations: action((state, payload) => { state.selectedAllocations = payload; }), appendSelectedAllocation: action((state, payload) => { state.selectedAllocations = state.selectedAllocations.filter(id => id !== payload).concat(payload); }), removeSelectedAllocation: action((state, payload) => { state.selectedAllocations = state.selectedAllocations.filter(id => id !== payload); }), }; export type { AdminAllocationStore }; export default allocations;