Skip to content

Commit

Permalink
Refactor rename getFileSources to fetchFileSources
Browse files Browse the repository at this point in the history
To clearly indicate that the function is fetching the file sources from the server
and not just returning them from the store.
  • Loading branch information
davelopez committed May 15, 2024
1 parent 46a5dcb commit f432ddf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions client/src/api/remoteFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export interface FilterFileSourcesOptions {
exclude?: FileSourcePluginKind[];
}

const getRemoteFilesPlugins = fetcher.path("/api/remote_files/plugins").method("get").create();
const remoteFilesPluginsFetcher = fetcher.path("/api/remote_files/plugins").method("get").create();

/**
* Get the list of available file sources from the server that can be browsed.
* @param options The options to filter the file sources.
* @returns The list of available (browsable) file sources from the server.
*/
export async function getFileSources(options: FilterFileSourcesOptions = {}): Promise<BrowsableFilesSourcePlugin[]> {
const { data } = await getRemoteFilesPlugins({
export async function fetchFileSources(options: FilterFileSourcesOptions = {}): Promise<BrowsableFilesSourcePlugin[]> {
const { data } = await remoteFilesPluginsFetcher({
browsable_only: true,
include_kind: options.include,
exclude_kind: options.exclude,
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/FilesDialog/FilesDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Vue, { computed, onMounted, ref } from "vue";
import {
browseRemoteFiles,
fetchFileSources,
FileSourceBrowsingMode,
FilterFileSourcesOptions,
getFileSources,
RemoteEntry,
} from "@/api/remoteFiles";
import { UrlTracker } from "@/components/DataDialog/utilities";
Expand Down Expand Up @@ -231,7 +231,7 @@ function load(record?: SelectionItem) {
undoShow.value = !urlTracker.value.atRoot();
if (urlTracker.value.atRoot() || errorMessage.value) {
errorMessage.value = undefined;
getFileSources(props.filterOptions)
fetchFileSources(props.filterOptions)
.then((results) => {
const convertedItems = results
.filter((item) => !props.requireWritable || item.writable)
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/HistoryImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import { getAppRoot } from "onload/loadConfig";
import { errorMessageAsString } from "utils/simple-error";
import Vue, { ref, watch } from "vue";
import { getFileSources } from "@/api/remoteFiles";
import { fetchFileSources } from "@/api/remoteFiles";
import ExternalLink from "./ExternalLink";
Expand Down Expand Up @@ -163,7 +163,7 @@ export default {
},
methods: {
async initialize() {
const fileSources = await getFileSources();
const fileSources = await fetchFileSources();
this.hasFileSources = fileSources.length > 0;
this.initializing = false;
},
Expand Down

0 comments on commit f432ddf

Please sign in to comment.