JSFiddle - React, Tailwind, and code Playground

by stuttufu

JavaScript

get catalog() {
  	return new Promise((resolve, reject) => {
    	if (!this._catalog) {
      	resolve(this._catalog);
        this._client.getCatalog()
          .then(c => {
            this._catalog = c;
						resolve(c);
          })
          .catch(err => {
            // now the Promise is handled
          	console.warn(err);
            reject(err);
          })
      }
    });
  }