0
constructor() {
 super();
 this.xmlRequests = [getRequestForLedgers, getRequestForStockItems, 
  getRequestForOutstanding];
}
componentDidMount() {
 const url = 'http://localhost:9000/';
 let count = 0;
 Observable.interval(50000).mergeMap(() =>
 Observable.from(this.xmlRequests))
 .mergeMap(getRequest =>
  Observable.fromPromise(axios.post(url, getRequest())))
 .map(response => {
  //console.log(response);
  toJson(response.data, (err, result) => {
   console.log(result):
  }
 .subscribe(a => console.log(a));
}

In code: this.xmlRequests contains a array of functions which returns a content of xml request. I am trying to send three different xml request to tally using rxjs post method, and i want to track which response is coming from tally as per xml request because i need to execute three different graphql mutation on each response.

Avijit Dutta
  • 3,651
  • 3
  • 13
  • 16
  • Please help me! – Avijit Dutta Jun 16 '17 at 11:54
  • You're not returning anything inside your `map()` operator... – martin Jun 16 '17 at 13:06
  • Sorry! why i need to return inside map() operator?? I'm track the response inside map() after fromPromise() operator which sends a xml request using axios to tally... can you explain what are you trying to say @martin !! – Avijit Dutta Jun 16 '17 at 13:28
  • 1
    Your question is very unclear. If you need help you need to make it clearer for us to understand what you need. Where is it failing? Does any of `console.log()` print out anything? Why making post request to endpoint that will actually do get request? And as @martin said, map doesn't return anything, so I believe you shouldn't expect anything in your subscribe either – SasaT Jun 16 '17 at 14:20

0 Answers0