title: JS return value of a nested .then
body: <p>I know this has been asked but specifically here I'm dealing with a nested .then.
  I have the following function:</p>
  
  <pre><code>function somethingCreate() {
    getMainThemeId();
    .then(result =&gt; alert(result))
  }
  
  function getMainThemeId() {
    shopify.theme
      .list()
      .then(themes =&gt; {
        let theme = themes.find(o =&gt; o.role === 'main');
        return theme;
      })
      .catch((err) =&gt; console.error(err.response.body));
  }
  </code></pre>
  
  <p>The method somethingCreate is going to contain more methods so I need the result of getMainThemeId.  shopify.theme is an api module I'm working with and it properly returns the results for theme.  The problem is I'm stuck on returning that to the method somethingCreate().  Any idea how I can accomplish this?</p>