retrywhen

Angular 5.2 & RxJS 5.5 HttpInterceptor retryWhen, but update request?

隐身守侯 提交于 2019-12-24 02:07:27
问题 I am trying to intercept a 401 response, send a refresh token request before trying request again (but with a different header). I have it working except retryWhen does not give me to modify the original request header. So I've been trying to use catchError instead but I cannot seem to execute the request again. Here is my current retryWhen : import {Injectable} from '@angular/core'; import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpErrorResponse } from '@angular/common/http'

Retry a call with Retrofit 2 and RxJava2 after displaying a dialog

巧了我就是萌 提交于 2019-12-04 12:21:23
问题 I'm calling an API using Retrofit 2 and RxJava2. If a call fails, in some cases (e.g. no Internet connection), I want to display an error dialog to the user and let him retry. As I'm using RxJava, I was thinking of using .retryWhen(...) but I don't know how to do that as it needs to wait for the user to press the button on the dialog. At the moment I display the dialog but it retries before the user presses any button. Plus I would like the call to not be retried when the user presses 'cancel