src/components/feeder.js
/**
   * Send a request to endpoint API.
   *
   * @protected
   * @param {string} destination - The endpoint in this API
   * @param {Object} query The query params to send to API
   * @param {string|Array|Object} keyForCache The key to use to cache the body
   * @return {Promise} a pending Promise
   *
   */
Send a request to endpoint API.
Send a request to endpoint API .
async requestAPI(destination, query, keyForCache) {
    if (keyForCache) {
      const cachedResp = await this.getCached(keyForCache);
      if (cachedResp !== null) {
        return cachedResp;
      }
    }
    try {
      const {
        body,
      } = await request
        .get(this.apiEndPoint_ + destination)
        .query(query);
      return this.cacheResponse(keyForCache, body);
    } catch (err) {
      throw err;
    }
  }
async requestAPI ( destination , query , keyForCache ) { if ( keyForCache ) { const cachedResp = await this . getCached ( keyForCache ) ; if ( cachedResp !== null ) { return cachedResp ; } } try { const { body , } = await request . get ( this . apiEndPoint_ + destination ) . query ( query ) ; return this . cacheResponse ( keyForCache , body ) ; } catch ( err ) { throw err ; } }
Send a request to endpoint API.
Send a request to endpoint API .
// Get The cached response for this request // Request No cache-able // no cached response for this req // if (!destination) { //   throw new Error('Missing the destination for ' + this.apiEndPoint_); // } // if (!destination.startsWith('/')) { //   destination = '/' + destination; // } // Sending the request to the API // Store the resp in cache if necessary.