Skip to content

Commit

Permalink
Swap ToolSection to watch vueuse eventbus
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Nov 15, 2023
1 parent 8d8a66d commit 2bfec6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/src/components/History/CurrentHistory/HistoryEmpty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEventBus } from "@vueuse/core";
import { useGlobalUploadModal } from "@/composables/globalUploadModal";
import { localize } from "@/utils/localization";
const { emit } = useEventBus("open-tool-section");
const { emit } = useEventBus<string>("open-tool-section");
const props = withDefaults(
defineProps<{
Expand All @@ -19,7 +19,7 @@ const props = withDefaults(
const { openGlobalUploadModal } = useGlobalUploadModal();
function clickDataLink() {
emit("openToolSection", "getext");
emit("getext");
}
</script>

Expand Down
8 changes: 5 additions & 3 deletions client/src/components/Panels/Common/ToolSection.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useEventBus } from "@vueuse/core";
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import { eventHub } from "@/components/plugins/eventHub.js";
import { useConfig } from "@/composables/config";
import { type ToolSectionLabel, useToolStore } from "@/stores/toolStore";
import ariaAlert from "@/utils/ariaAlert";
Expand All @@ -15,6 +15,8 @@ const emit = defineEmits<{
(e: "onOperation", tool: any, evt: Event): void;
}>();
const eventHub = useEventBus<string>("open-tool-section");
const props = defineProps({
category: {
type: Object,
Expand Down Expand Up @@ -132,11 +134,11 @@ watch(
);
onMounted(() => {
eventHub.$on("openToolSection", openToolSection);
eventHub.on(openToolSection);
});
onUnmounted(() => {
eventHub.$off("openToolSection", openToolSection);
eventHub.off(openToolSection);
});
function openToolSection(sectionId: string) {
Expand Down

0 comments on commit 2bfec6c

Please sign in to comment.