Hi Arnaud,
Thanks for your response.
I did not understand it completely. The moment I call method in subsequent
request session becomes undefined. Here is the code I am attaching.

      sessionId : string = "";

   this.loginService.getSession(t)
      .subscribe(data => {
        this.result=JSON.parse(JSON.stringify(data));
         sessionId = this.result;
      }, error => {
        this.result = JSON.stringify(error).toString();
      });
  // I only want to return result from below method to consumer while
session is created in each request. I cannot store sessionId from
//getSession. I am not sure how to combine them
     this.loginService.searchDocument(this.sessionId , bodymsg)
      .subscribe(data => {
        this.result=JSON.parse(JSON.stringify(data));
      }, error => {
        this.result = JSON.stringify(error).toString();
      });



Regards
Sandeep Sjhukla

On Tue, Oct 20, 2020 at 11:40 AM Arnaud Deman <[email protected]> wrote:

> Hello Sandeep,
> Assuming the backend calls return Observables, you could do something like
> this (untested):
> getSession (). pipe (
> mergeMap (sessions => getInformation (session))
> );
>
> This would return an Observable of the same type as getInformation
> (session).
>
> Regards,
> Arnaud.
>
>
> On Monday, 19 October 2020 at 11:35:49 UTC+2 [email protected] wrote:
>
>> Hi,
>>
>> I would like to call an service in which I need a session value. I dont
>> want customer to enter the login details to create the session rather on
>> page load itself I would like to provide the details.
>>
>> 1)  var session =  getSession();  // rest call from backend
>>
>>  2) var info = getInformation (session) ; //rest call from backend
>>
>>  3) return infor to cleint
>>
>>  I would like to know how I can do it with one call. It does not work for
>> me.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/angular/d2ffc870-f1cd-4f18-96ca-357bccb163ccn%40googlegroups.com
> <https://groups.google.com/d/msgid/angular/d2ffc870-f1cd-4f18-96ca-357bccb163ccn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Regards
Sandeep Shukla,
Mobile# +31647969951

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/CAB0%2BwtAqUzP%2B-RvwyShory7pgbOEHdejEpbPNkPmZwzm8bhs3g%40mail.gmail.com.

Reply via email to