0

I know this has been asked but specifically here I'm dealing with a nested .then. I have the following function:

function somethingCreate() {
  getMainThemeId();
  .then(result => alert(result))
}

function getMainThemeId() {
  shopify.theme
    .list()
    .then(themes => {
      let theme = themes.find(o => o.role === 'main');
      return theme;
    })
    .catch((err) => console.error(err.response.body));
}

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?

FabricioG
  • 3,107
  • 6
  • 35
  • 74

0 Answers0