public/js/services/StockService.js
/**
   * Extracts data from the result of the promise if successful,
   * otherwise logs the error and rejects
   * @param {promise}
   * @returns {promise}
   */
Extracts data from the result of the promise if successful,
otherwise logs the error and rejects
@param {promise}
@returns {promise}
Extracts data from the result of the promise if successful otherwise logs the error and rejects @param { promise } @returns { promise }
function handlePromise(promise) {
    return new Promise((resolve, reject) => {
      promise.then((result) => {
        resolve(result.data);
      }).catch((error) => {
        reject(error);
      });
    });
  }
function handlePromise ( promise ) { return new Promise ( ( resolve , reject ) => { promise . then ( ( result ) => { resolve ( result . data ) ; } ) . catch ( ( error ) => { reject ( error ) ; } ) ; } ) ; }
Extracts data from the result of the promise if successful,
 otherwise logs the error and rejects
 @param {promise}
 @returns {promise}
Extracts data from the result of the promise if successful otherwise logs the error and rejects @param { promise } @returns { promise }