diff --git a/client/src/components/Common/ExportRecordDOILink.vue b/client/src/components/Common/ExportRecordDOILink.vue index b64c09bada8e..80aeb46536b4 100644 --- a/client/src/components/Common/ExportRecordDOILink.vue +++ b/client/src/components/Common/ExportRecordDOILink.vue @@ -7,7 +7,6 @@ import { useFileSources } from "@/composables/fileSources"; import DOILink from "./DOILink.vue"; -// TODO: This should be using a store so we don't have to load file sources in every component const { getFileSourceByUri, isLoading: isLoadingFileSources } = useFileSources({ include: ["rdm"] }); interface Props { diff --git a/client/src/composables/fileSources.ts b/client/src/composables/fileSources.ts index 58b5a9cbb53a..674149d064aa 100644 --- a/client/src/composables/fileSources.ts +++ b/client/src/composables/fileSources.ts @@ -1,6 +1,7 @@ import { onMounted, readonly, ref } from "vue"; -import { BrowsableFilesSourcePlugin, FilterFileSourcesOptions, getFileSources } from "@/api/remoteFiles"; +import { BrowsableFilesSourcePlugin, FilterFileSourcesOptions } from "@/api/remoteFiles"; +import { useFileSourcesStore } from "@/stores/fileSourcesStore"; /** * Composable for accessing and working with file sources. @@ -8,12 +9,14 @@ import { BrowsableFilesSourcePlugin, FilterFileSourcesOptions, getFileSources } * @param options - The options to filter the file sources. */ export function useFileSources(options: FilterFileSourcesOptions = {}) { + const fileSourcesStore = useFileSourcesStore(); + const isLoading = ref(true); const hasWritable = ref(false); const fileSources = ref([]); onMounted(async () => { - fileSources.value = await getFileSources(options); + fileSources.value = await fileSourcesStore.getFileSources(options); hasWritable.value = fileSources.value.some((fs) => fs.writable); isLoading.value = false; });