onRequest method
Called before a request is sent.
Implementation
@override
void onRequest(RequestOptions options, handler) {
if (isPreemptivelyRefreshBeforeExpiry &&
!authOptions.ignoreAuthForPaths.contains(options.path)) {
try {
final isExpired = JwtDecoder.isExpired(authHandler.jwt ?? '');
if (isExpired) {
authHandler.refreshTokenCallback(options, handler);
} else {
handler.next(options);
}
} catch (e) {
debugPrint(e.toString());
}
} else {
handler.next(options);
}
}