Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 518 Bytes

fixtures.md

File metadata and controls

28 lines (20 loc) · 518 Bytes

Fixtures

Change invoke steps according to current env

import ALL_USERS_FIXTURE form 'fixtures/all-users';

class UserDataSource extends DataSource {

  static steps = process.env.NODE_ENV === 'development'
    ? ['fixture', 'immutable']
    : ['api', 'immutable'];

  immutable = response => Immutable.fromJSON(response);

  static fixture = {
    loadAll: ALL_USERS_FIXTURE
  };

  static api = {
    loadAll: api('GET /users')
  };

  loadAll(params) {
    return this.invoke('loadAll', params);
  }
}