examples/demo-app/src/actions.js
function loadRemoteSampleMap(options) {
  return (dispatch) => {
    // Load configuration first
    const {configUrl, dataUrl} = options;

    Promise
      .all([loadRemoteConfig(configUrl), loadRemoteData(dataUrl)])
      .then(
        ([config, data]) => {
          // TODO: these two actions can be merged
          dispatch(loadRemoteResourceSuccess(data, config, options));
          dispatch(toggleModal(null));
        },
        error => {
          if (error) {
            const {target = {}} = error;
            const {status, responseText} = target;
            dispatch(loadRemoteResourceError({status, message: `${responseText} - ${LOADING_SAMPLE_ERROR_MESSAGE} ${options.id} (${configUrl})`}, configUrl));
          }
        }
      );
  }
}
function loadRemoteSampleMap(options) {
  return (dispatch) => {
    // Load configuration first
    const {configUrl, dataUrl} = options;

    Promise
      .all([loadRemoteConfig(configUrl), loadRemoteData(dataUrl)])
      .then(
        ([config, data]) => {
          // TODO: these two actions can be merged
          dispatch(loadRemoteResourceSuccess(data, config, options));
          dispatch(toggleModal(null));
        },
        error => {
          if (error) {
            const {target = {}} = error;
            const {status, responseText} = target;
            dispatch(loadRemoteResourceError({status, message: `${responseText} - ${LOADING_SAMPLE_ERROR_MESSAGE} ${options.id} (${configUrl})`}, configUrl));
          }
        }
      );
  }
}
function loadRemoteSampleMap ( options ) { return ( dispatch ) => { // Load configuration first const { configUrl , dataUrl } = options ; Promise . all ( [ loadRemoteConfig ( configUrl ) , loadRemoteData ( dataUrl ) ] ) . then ( ( [ config , data ] ) => { // TODO: these two actions can be merged dispatch ( loadRemoteResourceSuccess ( data , config , options ) ) ; dispatch ( toggleModal ( null ) ) ; } , error => { if ( error ) { const { target = { } } = error ; const { status , responseText } = target ; dispatch ( loadRemoteResourceError ( { status , message : ` ${ responseText } ${ LOADING_SAMPLE_ERROR_MESSAGE } ${ options . id } ${ configUrl } ` } , configUrl ) ) ; } } ) ; } }
Load remote map with config and data
@param options {configUrl, dataUrl}
@returns {Function}
Load remote map with config and data