0

I need to set response data to context.forecast. I tried by using GET method inside the if loop but context becomes undefined. Is there a way to define GET function outside and just call to get the value into data variable?

Note: the location variable need to be passed into GET URL

getForecast({context, entities}) {
    var location = firstEntityValue(entities, 'location');
    if (location) {
      delete context.missingLocation;
      //TODO
      //var data = GET URL
        context.forecast = data
      })
    } else {
      context.missingLocation = true;
      delete context.forecast;
    }
    return context;
  }
Lazyexpert
  • 3,106
  • 1
  • 19
  • 33

0 Answers0