function fetch(query, context, forceCache) {
    let service = ServiceManager.getService(query.service);

    return (dispatch, getState) => {
        let requestID = service.getRequestID(query, context);

        if (context) {
            const pQuery = parameterizedConfiguration(query, context);

            if (pQuery)
                query = pQuery;
            else
                return Promise.reject("Provided context does not allow to parameterized query " + query.id);
        }

        dispatch(didStartRequest(requestID));

        return service.fetch(query, getState())
            .then(
            (results) => {
                const data = ServiceManager.tabify(query, results);
                dispatch(didReceiveResponse(requestID, data));
                return Promise.resolve(data);
            },
            (error) => {
                if (process.env.NODE_ENV === "development" && service.hasOwnProperty("getMockResponse")) {
                    try {
                        const response = service.getMockResponse(query);
                        dispatch(didReceiveResponse(requestID, response, forceCache));
                    } catch(e) {
                        dispatch(didReceiveError(requestID, e, forceCache));
                    }

                    return Promise.resolve();
                }
                else
                {
                    dispatch(didReceiveError(requestID, error));
                    return Promise.resolve();
                }
            });

    }
}
/*
    Make a query on the service based on the service name.

    Arguments:
    * query: the query configuration
    * context: the context if the query should be parameterized
    * forceCache: a boolean to force storing the value for a long period
*/
Make a query on the service based on the service name.
Arguments:
query: the query configuration
context: the context if the query should be parameterized
forceCache: a boolean to force storing the value for a long period
Make a query on the service based on the service name . Arguments : query : the query configuration context : the context if the query should be parameterized forceCache : a boolean to force storing the value for a long period
function fetch(query, context, forceCache) {
    let service = ServiceManager.getService(query.service);
    return (dispatch, getState) => {
        let requestID = service.getRequestID(query, context);
        if (context) {
            const pQuery = parameterizedConfiguration(query, context);
            if (pQuery)
                query = pQuery;
            else
                return Promise.reject("Provided context does not allow to parameterized query " + query.id);
        }
        dispatch(didStartRequest(requestID));
        return service.fetch(query, getState())
            .then(
            (results) => {
                const data = ServiceManager.tabify(query, results);
                dispatch(didReceiveResponse(requestID, data));
                return Promise.resolve(data);
            },
            (error) => {
                if (process.env.NODE_ENV === "development" && service.hasOwnProperty("getMockResponse")) {
                    try {
                        const response = service.getMockResponse(query);
                        dispatch(didReceiveResponse(requestID, response, forceCache));
                    } catch(e) {
                        dispatch(didReceiveError(requestID, e, forceCache));
                    }
                    return Promise.resolve();
                }
                else
                {
                    dispatch(didReceiveError(requestID, error));
                    return Promise.resolve();
                }
            });
    }
}
function fetch ( query , context , forceCache ) { let service = ServiceManager . getService ( query . service ) ; return ( dispatch , getState ) => { let requestID = service . getRequestID ( query , context ) ; if ( context ) { const pQuery = parameterizedConfiguration ( query , context ) ; if ( pQuery ) query = pQuery ; else return Promise . reject ( "Provided context does not allow to parameterized query " + query . id ) ; } dispatch ( didStartRequest ( requestID ) ) ; return service . fetch ( query , getState ( ) ) . then ( ( results ) => { const data = ServiceManager . tabify ( query , results ) ; dispatch ( didReceiveResponse ( requestID , data ) ) ; return Promise . resolve ( data ) ; } , ( error ) => { if ( process . env . NODE_ENV === "development" && service . hasOwnProperty ( "getMockResponse" ) ) { try { const response = service . getMockResponse ( query ) ; dispatch ( didReceiveResponse ( requestID , response , forceCache ) ) ; } catch ( e ) { dispatch ( didReceiveError ( requestID , e , forceCache ) ) ; } return Promise . resolve ( ) ; } else { dispatch ( didReceiveError ( requestID , error ) ) ; return Promise . resolve ( ) ; } } ) ; } }
Make a query on the service based on the service name.
Make a query on the service based on the service name .