From 4439afa525f739c0cbf681f0ced3891a994bd85e Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 24 Oct 2023 10:21:56 -0500 Subject: [PATCH] change `then/catch` into `try/catch` remove `Ref` type import, type directly instead --- .../History/CurrentHistory/HistoryPanel.vue | 23 +++++++++---------- client/src/stores/historyItemsStore.ts | 6 ++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index be929a5f2775..6705265b40de 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -411,18 +411,17 @@ export default { if (data) { const dataSource = data.history_content_type === "dataset" ? "hda" : "hdca"; if (data.history_id != this.historyId) { - await copyDataset(data.id, this.historyId, data.history_content_type, dataSource) - .then(() => { - if (data.history_content_type === "dataset") { - Toast.info("Dataset copied to history"); - } else { - Toast.info("Collection copied to history"); - } - this.loadHistoryById(this.historyId); - }) - .catch((error) => { - this.onError(error); - }); + try { + await copyDataset(data.id, this.historyId, data.history_content_type, dataSource); + if (data.history_content_type === "dataset") { + Toast.info("Dataset copied to history"); + } else { + Toast.info("Collection copied to history"); + } + this.loadHistoryById(this.historyId); + } catch (error) { + this.onError(error); + } } } }, diff --git a/client/src/stores/historyItemsStore.ts b/client/src/stores/historyItemsStore.ts index 7e38e8d5b4aa..f1b6b8b91544 100644 --- a/client/src/stores/historyItemsStore.ts +++ b/client/src/stores/historyItemsStore.ts @@ -6,7 +6,7 @@ import { reverse } from "lodash"; import { defineStore } from "pinia"; -import Vue, { computed, Ref, ref } from "vue"; +import Vue, { computed, ref } from "vue"; import { HistoryFilters } from "@/components/History/HistoryFilters"; import { mergeArray } from "@/store/historyStore/model/utilities"; @@ -21,12 +21,12 @@ const limit = 100; const queue = new LastQueue(); export const useHistoryItemsStore = defineStore("historyItemsStore", () => { - const items: Ref> = ref({}); + const items = ref>({}); const itemKey = ref("hid"); const totalMatchesCount = ref(undefined); const lastCheckedTime = ref(new Date()); const lastUpdateTime = ref(new Date()); - const relatedItems: Ref> = ref({}); + const relatedItems = ref>({}); const isWatching = ref(false); const getHistoryItems = computed(() => {