Blame view

imports/client/views/nonOrg/app/module/navigation/index.js 1.24 KB
a8c5a7fb6   Deepak   added teachers view
1
2
3
4
5
6
7
8
  // import { AppNavigation } from '/imports/client/views/nonOrg/app/module/navigation/index'
  import _                                  from 'lodash';
  import {
           composeWithTracker,
           compose,
           composeAll
         }                                  from 'react-komposer';
  import { Loading }                        from '/imports/client/components/Loading';
8c4a3096b   Deepak   added settings an...
9

a8c5a7fb6   Deepak   added teachers view
10
11
  import { Orgs }                           from '/imports/collections/orgs/index';
  import { Users }                          from '/imports/collections/users/index';
8c4a3096b   Deepak   added settings an...
12

a8c5a7fb6   Deepak   added teachers view
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
47
48
49
  import { AppNavigation }                  from './AppNavigation';
  
  const meteorTick = (props, onData) => {
  
    const handles = [
      Meteor.subscribe('users.current'),
      Meteor.subscribe('orgs.current')
    ];
  
    if(_.every(handles, (handle) => (handle.ready()) )) {
      const user = Users.current();
      const org = Orgs.current();
      onData(null, {
        data: {
          user: user,
          org: org
        },
      });
    }
  
    return () => {
      _.each(handles, (handle) => handle.stop() );
    };
  };
  
  
  const reduxTick = (props, onData) => {
    onData(null, {
      data: {}
    });
  };
  
  
  export const AppNavigationController = composeAll(
    composeWithTracker(meteorTick, Loading),
    compose(reduxTick, Loading),
  )(AppNavigation);