Skip to content

Commit

Permalink
Improve imports from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Laila Los <[email protected]>
  • Loading branch information
davelopez and ElectronicBlueberry committed Oct 11, 2023
1 parent cb0f62e commit c4529f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions client/src/stores/collectionAttributesStore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defineStore } from "pinia";
import Vue, { computed, ref } from "vue";
import { computed, del, ref, set } from "vue";

import { DatasetCollectionAttributes } from "./services";
import * as Service from "./services/datasetCollection.service";
import { fetchCollectionAttributes } from "./services/datasetCollection.service";

export const useCollectionAttributesStore = defineStore("collectionAttributesStore", () => {
const storedAttributes = ref<{ [key: string]: DatasetCollectionAttributes }>({});
Expand All @@ -11,7 +11,7 @@ export const useCollectionAttributesStore = defineStore("collectionAttributesSto
const getAttributes = computed(() => {
return (hdcaId: string) => {
if (!storedAttributes.value[hdcaId]) {
Vue.set(storedAttributes.value, hdcaId, {});
set(storedAttributes.value, hdcaId, {});
fetchAttributes({ hdcaId });
}
return storedAttributes.value[hdcaId];
Expand All @@ -25,13 +25,13 @@ export const useCollectionAttributesStore = defineStore("collectionAttributesSto
});

async function fetchAttributes(params: { hdcaId: string }) {
Vue.set(loadingAttributes.value, params.hdcaId, true);
set(loadingAttributes.value, params.hdcaId, true);
try {
const attributes = await Service.fetchCollectionAttributes(params);
Vue.set(storedAttributes.value, params.hdcaId, attributes);
const attributes = await fetchCollectionAttributes(params);
set(storedAttributes.value, params.hdcaId, attributes);
return attributes;
} finally {
Vue.delete(loadingAttributes.value, params.hdcaId);
del(loadingAttributes.value, params.hdcaId);
}
}

Expand Down

0 comments on commit c4529f7

Please sign in to comment.