fix(auth): handle 400 error during token refresh flow
This commit is contained in:
@@ -156,7 +156,8 @@ abstract class BaseController extends GetxController
|
||||
bool validateUrgentException(dynamic exception) {
|
||||
return exception is NoNetworkError
|
||||
|| exception is BadCredentialsException
|
||||
|| exception is ConnectionError;
|
||||
|| exception is ConnectionError
|
||||
|| exception is RefreshTokenFailedException;
|
||||
}
|
||||
|
||||
void handleErrorViewState(Object error, StackTrace stackTrace) {}
|
||||
@@ -177,6 +178,8 @@ abstract class BaseController extends GetxController
|
||||
_handleConnectionErrorException();
|
||||
} else if (exception is BadCredentialsException) {
|
||||
handleBadCredentialsException();
|
||||
} else if (exception is RefreshTokenFailedException) {
|
||||
handleRefreshTokenFailedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,6 +191,8 @@ abstract class BaseController extends GetxController
|
||||
_handleConnectionErrorException();
|
||||
} else if (exception is BadCredentialsException) {
|
||||
handleBadCredentialsException();
|
||||
} else if (exception is RefreshTokenFailedException) {
|
||||
handleRefreshTokenFailedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +247,15 @@ abstract class BaseController extends GetxController
|
||||
clearDataAndGoToLoginPage();
|
||||
}
|
||||
|
||||
void handleRefreshTokenFailedException() {
|
||||
log('$runtimeType::handleRefreshTokenFailedException:');
|
||||
if (twakeAppManager.hasComposer) {
|
||||
_performSaveAndReconnection();
|
||||
} else {
|
||||
_performReconnection();
|
||||
}
|
||||
}
|
||||
|
||||
void onDataFailureViewState(Failure failure) {
|
||||
log('$runtimeType::onDataFailureViewState:failure = ${failure.runtimeType}');
|
||||
if (failure is FeatureFailure) {
|
||||
|
||||
Reference in New Issue
Block a user