Skip to main content

loadFiles()

Description

Gets a promise with an array of files objects
info

The loadFiles() method is a part of the RestDataProvider service intended for working with the server

Usage

loadFiles(
id?: string
): Promise<obj[]>

Parameters

  • id - (optional) the id of a folder where items will be loaded (which is a path to the folder)

Returns

The loadFiles() method sends a request to the server by the GET method and returns a promise with the files data (an array of files). For an example of the data object, see the data property description.

Examples

<script setup>
import { RestDataProvider } from "@svar-ui/filemanager-data-provider";
import { Filemanager } from "@svar-ui/vue-filemanager";
import { ref } from "vue";

const url = "https://some-backend-url";

const restProvider = new RestDataProvider(url);

const data = ref([]);

function init(api) {
api.setNext(restProvider);
Promise.all([restProvider.loadFiles()]).then(([files]) => {
data.value = files;
});
}
</script>

<template>
<Filemanager :init="init" :data="data" />
</template>

Related articles: