Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 416 Bytes

auto-invoke-methods.md

File metadata and controls

20 lines (16 loc) · 416 Bytes

Auto Invoke Methods

import DataSource from 'bivrost/data/source';

class UsersDataSource extends DataSource {
  static api = {
    loadAll: api('GET /users'),
    load: api('GET /users/:id'),
    create: api('POST /users'),
  };
}

const usersDataSource = new UsersDataSource();

// Generated methods:
usersDataSource.invokeLoad({});
usersDataSource.invokeLoadAll({});
usersDataSource.invokeCreate({});