loadFiles()
Description
Gets a promise with an array of files objectsinfo
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>
import { RestDataProvider } from "wx-filemanager-data-provider";
import { Filemanager } from "wx-svelte-filemanager";
const url = "https://some-backend-url";
const restProvider = new RestDataProvider(url);
let fmApi;
$: data = [];
function init(api) {
fmApi = api;
api.setNext(restProvider);
}
Promise.all([restProvider.loadFiles()]).then(([files]) => {
data = files;
});
</script>
<Filemanager {init} {data} />
Related articles: