Blame view

imports/ui/containers/documents-list.js 683 Bytes
d1f05315d   tmcdeveloper   wip adding API an...
1
2
3
  import { composeWithTracker } from 'react-komposer';
  import { Documents } from '../../api/documents/documents.js';
  import { DocumentsList } from '../components/documents-list.js';
aae5ce922   tmcdeveloper   wire up custom lo...
4
  import { Loading } from '../components/loading.js';
d1f05315d   tmcdeveloper   wip adding API an...
5

f0c912bf1   tmcdeveloper   add method tests ...
6
7
8
9
  const composer = (params, onReady) => {
    const subscription = Meteor.subscribe('documents');
    if (subscription.ready()) {
      const documents = Documents.find().fetch();
aae5ce922   tmcdeveloper   wire up custom lo...
10
11
12
      // setTimeout is used to visually buffer the loading spinner so it's not
      // jarring. Can just call onReady directly if you wish :)
      setTimeout(() => { onReady(null, { documents }); }, 500);
d1f05315d   tmcdeveloper   wip adding API an...
13
14
    }
  };
aae5ce922   tmcdeveloper   wire up custom lo...
15
  export default composeWithTracker(composer, Loading)(DocumentsList);