Skip to content

Commit

Permalink
Add getDragItems to eventStore to avoid duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Jun 3, 2024
1 parent 2c4ad24 commit a9bc8c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/src/stores/eventStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export const useEventStore = defineStore("eventStore", () => {
return dragData.value;
}

function getDragItems(): EventData[] {
if (!dragData.value) {
return [];
}
return multipleDragData.value ? (Object.values(dragData.value) as EventData[]) : [dragData.value];
}

function setDragData(data: EventData, multiple = false) {
dragData.value = data;
multipleDragData.value = multiple;
Expand All @@ -32,6 +39,7 @@ export const useEventStore = defineStore("eventStore", () => {
multipleDragData,
clearDragData,
getDragData,
getDragItems,
setDragData,
};
});

0 comments on commit a9bc8c4

Please sign in to comment.