function loadCategories(send) {
  var state = store.getState();

  if(!state.baseUrl) return false;

  var apiUrl = config.formAPIUrl(state.baseUrl);

  console.log('API:', apiUrl);

  categoryNames.forEach(function (cat) {
    var catUrl = help.joinUrl(apiUrl, cat);

    request(catUrl, function (err, res, body) {
      if(err) console.log(err);

      if(!err && res.statusCode == 200) {
        var list = JSON.parse(body);
        var collection = store.addCollection(cat);
        collection.clean();
        collection.add(list);
        console.log('Load:', collection.name);

        if(collection.name == 'filters') {
          return send('update_filters', collection.all);
        }
      }
    });
  });
}
/**
 * Load all categories
 * @param {Function} send send message to the page callback
 */
Load all categories
@param {Function} send send message to the page callback
Load all categories @param { Function } send send message to the page callback
function loadCategories(send) {
  var state = store.getState();
  if(!state.baseUrl) return false;
  var apiUrl = config.formAPIUrl(state.baseUrl);
  console.log('API:', apiUrl);
  categoryNames.forEach(function (cat) {
    var catUrl = help.joinUrl(apiUrl, cat);
    request(catUrl, function (err, res, body) {
      if(err) console.log(err);
      if(!err && res.statusCode == 200) {
        var list = JSON.parse(body);
        var collection = store.addCollection(cat);
        collection.clean();
        collection.add(list);
        console.log('Load:', collection.name);
        if(collection.name == 'filters') {
          return send('update_filters', collection.all);
        }
      }
    });
  });
}
function loadCategories ( send ) { var state = store . getState ( ) ; if ( ! state . baseUrl ) return false ; var apiUrl = config . formAPIUrl ( state . baseUrl ) ; console . log ( 'API:' , apiUrl ) ; categoryNames . forEach ( function ( cat ) { var catUrl = help . joinUrl ( apiUrl , cat ) ; request ( catUrl , function ( err , res , body ) { if ( err ) console . log ( err ) ; if ( ! err && res . statusCode == 200 ) { var list = JSON . parse ( body ) ; var collection = store . addCollection ( cat ) ; collection . clean ( ) ; collection . add ( list ) ; console . log ( 'Load:' , collection . name ) ; if ( collection . name == 'filters' ) { return send ( 'update_filters' , collection . all ) ; } } } ) ; } ) ; }
Load all categories
 @param {Function} send send message to the page callback
Load all categories @param { Function } send send message to the page callback