skip getting refresh token when calling login

This commit is contained in:
amirrezaghabeli
2025-08-30 09:23:01 +03:30
parent c10b071307
commit 86d5e82968
+11
View File
@@ -57,7 +57,18 @@ class NetworkManager {
'❌ Error: ${error.message} - ${error.requestOptions.path}',
);
appLogger.error('❌ Error type: ${error.type}');
if (error.response?.statusCode == 401) {
// Skip refresh token for login and refresh token endpoints
final path = error.requestOptions.path;
if (path.contains('/api/v1/profile/login') ||
path.contains('/api/v1/profile/refresh-token')) {
appLogger.info(
'🔄 Skipping token refresh for authentication endpoints',
);
return handler.next(error);
}
final newAccessToken = await refreshToken();
if (newAccessToken != null) {
mainDio.options.headers['Authorization'] = 'Bearer $newAccessToken';