SMS integrated with new ui

This commit is contained in:
2025-12-09 18:11:46 +05:30
parent 72a2c56392
commit 1a2dea611b
9 changed files with 515 additions and 9 deletions

View File

@@ -8,6 +8,42 @@ class AuthService {
final Dio _dio;
AuthService(this._dio);
Future <void> simVerify(String uuid, String cifNo) async{
try{
final response = await _dio.post(
'/api/sim-details-verify',
data: {
'uuid': uuid,
'cifNo': cifNo,
}
);
if (response.statusCode == 200) {
final String message = response.data.toString().trim().toUpperCase();
if (message == "VERIFIED") {
return; // Success
} else {
throw AuthException(message); // Throw message received
}
} else {
throw AuthException('Verification Failed');
}
} on DioException catch (e) {
if (kDebugMode) {
print(e.toString());
}
if (e.response?.statusCode == 401) {
throw AuthException(
e.response?.data['error'] ?? 'SOMETHING WENT WRONG');
}
throw NetworkException('Network error during verification');
}
catch (e) {
throw UnexpectedException(
'Unexpected error during verification: ${e.toString()}');
}
}
Future<AuthToken> login(AuthCredentials credentials) async {
try {
final response = await _dio.post(