import type { Action } from 'easy-peasy'; import { action } from 'easy-peasy'; interface AdminDatabaseStore { selectedDatabases: number[]; setSelectedDatabases: Action; appendSelectedDatabase: Action; removeSelectedDatabase: Action; } const databases: AdminDatabaseStore = { selectedDatabases: [], setSelectedDatabases: action((state, payload) => { state.selectedDatabases = payload; }), appendSelectedDatabase: action((state, payload) => { state.selectedDatabases = state.selectedDatabases.filter(id => id !== payload).concat(payload); }), removeSelectedDatabase: action((state, payload) => { state.selectedDatabases = state.selectedDatabases.filter(id => id !== payload); }), }; export type { AdminDatabaseStore }; export default databases;