Blame view

imports/client/views/org/app/module/Index.js 1.08 KB
39d8f536d   Deepak   some more cleamup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  // import { AppModule } from '/imports/client/views/app/module/index'
  import {
           composeWithTracker,
           compose,
           composeAll
         }                                  from 'react-komposer';
  import { AppLayout }                      from './AppLayout';
  import { Loading }                        from '/imports/client/components/Loading';
  
  import { Users }                          from '/imports/collections/users/index';
  import { Orgs }                           from '/imports/collections/orgs/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, {
      location: props.location,
      data: {}
    });
  };
  
  
  export const AppModule = composeAll(
    composeWithTracker(meteorTick, Loading),
    compose(reduxTick, Loading),
  )(AppLayout);