onJWTExpired method

dynamic onJWTExpired(
  1. DioException err,
  2. ErrorInterceptorHandler handler
)

Implementation

onJWTExpired(DioException err, ErrorInterceptorHandler handler) async {
  await NetworkHandler.refreshDeviceToken(force: true);
  RequestOptions requestOptions = err.requestOptions;

  if (kDebugMode) {
    // print("requestOptions.path");
    // print(requestOptions.path);
    // print(requestOptions.data);
    // print(requestOptions.method);
    // print(requestOptions.headers);
  }

  var response = await NetworkHandler.getInstance().request(
    requestOptions.path,
    cancelToken: requestOptions.cancelToken,
    data: requestOptions.data,
    onReceiveProgress: requestOptions.onReceiveProgress,
    onSendProgress: requestOptions.onSendProgress,
    queryParameters: requestOptions.queryParameters,
    options: Options(
      method: requestOptions.method,
      headers: requestOptions.headers,
    ),
  );
  return (response);
}