32 lines
1011 B
TypeScript
32 lines
1011 B
TypeScript
import { useConceptStore } from "~/store/concepts.store";
|
|
import type {
|
|
ConceptCreateEvent,
|
|
ConceptDeleteEvent,
|
|
ConceptDisableEvent,
|
|
ConceptEditEvent,
|
|
ConceptEnableEvent,
|
|
} from "../events/concept.events";
|
|
|
|
export const handlers = {
|
|
create: (event: ConceptCreateEvent) => {
|
|
const conceptStore = useConceptStore();
|
|
conceptStore.concepts[event.concept.id] = event.concept;
|
|
},
|
|
edit: (event: ConceptEditEvent) => {
|
|
const conceptStore = useConceptStore();
|
|
conceptStore.concepts[event.concept.id].value = event.concept.value;
|
|
},
|
|
delete: (event: ConceptDeleteEvent) => {
|
|
const conceptStore = useConceptStore();
|
|
delete conceptStore.concepts[event.id];
|
|
},
|
|
// enable: (event: ConceptEnableEvent) => {
|
|
// const conceptStore = useConceptStore();
|
|
// conceptStore.concepts[event.id].enabled = true;
|
|
// },
|
|
// disable: (event: ConceptDisableEvent) => {
|
|
// const conceptStore = useConceptStore();
|
|
// conceptStore.concepts[event.id].enabled = false;
|
|
// },
|
|
};
|