retryRequestIf method

FutureOr<bool> retryRequestIf(
  1. Exception exception
)

Implementation

FutureOr<bool> retryRequestIf(Exception exception) async {
  if (exception is NsgApiException) {
    if (exception.error.code == 401) {
      var provider = NsgDataClient.client.getNewObject(dataType).remoteProvider;
      await provider.connect(this);
      if (provider.isAnonymous) {
        //Ошибка авторизации - переход на логин
        await provider.openLoginPage();
      }
    }
    if (exception.error.code == 400) {
      return false;
    }
  }
  if (retryIf != null) {
    return await retryIf!(exception);
  }
  return !status.isEmpty;
}