index.js 1017 Bytes
// import { VerifyModule } from '/imports/client/views/verify/module/index'
import {
         composeWithTracker,
         compose,
         composeAll
       }                                  from 'react-komposer';
import { VerifyLayout }                   from './VerifyLayout';
import { Loading }                        from '/imports/client/components/Loading';

import { Users }                          from '/imports/collections/users/index';


const meteorTick = (props, onData) => {

  const handles = [
    Meteor.subscribe('users.current'),
  ];

  if(_.every(handles, (handle) => (handle.ready()) )) {
    const user = Users.current();
    onData(null, {
      data: {
        user: user,
      },
    });
  }

  return () => {
    _.each(handles, (handle) => handle.stop() );
  };
};


const reduxTick = (props, onData) => {
  onData(null, {
    data: {}
  });
};


export const VerifyModule = composeAll(
  composeWithTracker(meteorTick, Loading),
  compose(reduxTick, Loading),
)(VerifyLayout);