Skip to content

Commit

Permalink
change then/catch into try/catch
Browse files Browse the repository at this point in the history
remove `Ref` type import, type directly instead
  • Loading branch information
ahmedhamidawan committed Oct 24, 2023
1 parent 9d248c3 commit 4439afa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
23 changes: 11 additions & 12 deletions client/src/components/History/CurrentHistory/HistoryPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions client/src/stores/historyItemsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -21,12 +21,12 @@ const limit = 100;
const queue = new LastQueue();

export const useHistoryItemsStore = defineStore("historyItemsStore", () => {
const items: Ref<Record<string, HistoryItem[]>> = ref({});
const items = ref<Record<string, HistoryItem[]>>({});
const itemKey = ref("hid");
const totalMatchesCount = ref(undefined);
const lastCheckedTime = ref(new Date());
const lastUpdateTime = ref(new Date());
const relatedItems: Ref<Record<string, boolean>> = ref({});
const relatedItems = ref<Record<string, boolean>>({});
const isWatching = ref(false);

const getHistoryItems = computed(() => {
Expand Down

0 comments on commit 4439afa

Please sign in to comment.