getTasks()
Description
Gets a promise with an array of all tasks objects
info
The getTasks() method is a part of the RestDataProvider service intended for working with a server
Usage
getTasks(): Promise<obj[]>;
Response
The getTasks() method sends a request to the server by the GET method and returns a promise with the tasks data.
Example
const { ToDo, Toolbar, RestDataProvider } = todo;
const activeProject = null;
const url = "http://localhost:3000";
const restProvider = new RestDataProvider(url);
Promise.all([
restProvider.getTasks(),
restProvider.getProjects(),
]).then(([tasks, projects]) => {
const list = new ToDo("#root", {
tasks,
projects,
});
const toolbar = new Toolbar("#toolbar", {
api: list.api,
});
list.api.setNext(restProvider);
restProvider.setAPI(list.api);
});
Related articles: Working with Server