formatted the whole codebase

This commit is contained in:
asif
2025-08-18 03:20:05 +05:30
parent e2a809d363
commit e6ea764785
58 changed files with 470 additions and 373 deletions

View File

@@ -4,7 +4,6 @@ import '../../features/auth/models/auth_token.dart';
import '../../features/auth/models/auth_credentials.dart';
import '../../core/errors/exceptions.dart';
class AuthService {
final Dio _dio;
AuthService(this._dio);
@@ -15,7 +14,7 @@ class AuthService {
'/api/auth/login',
data: credentials.toJson(),
);
if (response.statusCode == 200) {
return AuthToken.fromJson(response.data);
} else {
@@ -30,7 +29,8 @@ class AuthService {
}
throw NetworkException('Network error during login');
} catch (e) {
throw UnexpectedException('Unexpected error during login: ${e.toString()}');
throw UnexpectedException(
'Unexpected error during login: ${e.toString()}');
}
}
@@ -40,7 +40,7 @@ class AuthService {
'/auth/refresh',
data: {'refresh_token': refreshToken},
);
if (response.statusCode == 200) {
return AuthToken.fromJson(response.data);
} else {
@@ -54,7 +54,7 @@ class AuthService {
Future<bool> checkTpin() async {
try {
final response = await _dio.get('/api/auth/tpin');
if (response.statusCode == 200) {
return response.data['tpinSet'] as bool;
} else {
@@ -66,7 +66,8 @@ class AuthService {
}
throw NetworkException('Network error during TPIN check');
} catch (e) {
throw UnexpectedException('Unexpected error during TPIN check: ${e.toString()}');
throw UnexpectedException(
'Unexpected error during TPIN check: ${e.toString()}');
}
}
@@ -76,7 +77,7 @@ class AuthService {
'/api/auth/tpin',
data: {'tpin': tpin},
);
if (response.statusCode != 200) {
throw AuthException('Failed to set TPIN');
}
@@ -86,8 +87,8 @@ class AuthService {
}
throw NetworkException('Network error during TPIN setup');
} catch (e) {
throw UnexpectedException('Unexpected error during TPIN setup: ${e.toString()}');
throw UnexpectedException(
'Unexpected error during TPIN setup: ${e.toString()}');
}
}
}
}