Skip to main content

getData()

Description

Gets a promise with an array of tasks and links objects
info

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

Usage

getData(): Promise<[]>

Response

The getData() method sends a request to the server by the GET method and returns a promise with data on links and tasks. For the examples of returned objects, see tasks and links

Example

<script>
import { Gantt } from "@wx/svelte-gantt";
import { RestDataProvider } from "@wx/gantt-data-provider";

const url = "https://some_backend_url";

const server = new RestDataProvider(url);
let api;
let tasks, links;

server.getData().then(data => {
tasks = data.tasks;
links = data.links;
});

$: if (api) api.setNext(server);

</script>
<Gantt
{tasks}
{links}
bind:api />

Related articles: