@@ -58,7 +58,9 @@ export abstract class AuthRequestService {
5858 public postToEndpoint ( method : string , body ?: any , options ?: HttpOptions ) : Observable < RemoteData < AuthStatus > > {
5959 const requestId = this . requestService . generateRequestId ( ) ;
6060
61- this . halService . getEndpoint ( this . linkName ) . pipe (
61+ const endpoint$ = this . halService . getEndpoint ( this . linkName ) ;
62+
63+ endpoint$ . pipe (
6264 filter ( ( href : string ) => isNotEmpty ( href ) ) ,
6365 map ( ( endpointURL ) => this . getEndpointByMethod ( endpointURL , method ) ) ,
6466 distinctUntilChanged ( ) ,
@@ -68,7 +70,9 @@ export abstract class AuthRequestService {
6870 this . requestService . send ( request ) ;
6971 } ) ;
7072
71- return this . fetchRequest ( requestId ) ;
73+ return endpoint$ . pipe (
74+ switchMap ( ( ) => this . fetchRequest ( requestId ) ) ,
75+ ) ;
7276 }
7377
7478 /**
@@ -79,7 +83,9 @@ export abstract class AuthRequestService {
7983 public getRequest ( method : string , options ?: HttpOptions , ...linksToFollow : FollowLinkConfig < any > [ ] ) : Observable < RemoteData < AuthStatus > > {
8084 const requestId = this . requestService . generateRequestId ( ) ;
8185
82- this . halService . getEndpoint ( this . linkName ) . pipe (
86+ const endpoint$ = this . halService . getEndpoint ( this . linkName ) ;
87+
88+ endpoint$ . pipe (
8389 filter ( ( href : string ) => isNotEmpty ( href ) ) ,
8490 map ( ( endpointURL ) => this . getEndpointByMethod ( endpointURL , method , ...linksToFollow ) ) ,
8591 distinctUntilChanged ( ) ,
@@ -89,7 +95,9 @@ export abstract class AuthRequestService {
8995 this . requestService . send ( request ) ;
9096 } ) ;
9197
92- return this . fetchRequest ( requestId , ...linksToFollow ) ;
98+ return endpoint$ . pipe (
99+ switchMap ( ( ) => this . fetchRequest ( requestId , ...linksToFollow ) ) ,
100+ ) ;
93101 }
94102 /**
95103 * Factory function to create the request object to send. This needs to be a POST client side and
0 commit comments