50fe9a9d36
App móvil para validar pases QR contra base-admin-web con login Cognito, escáner en tiempo real, feedback auditivo/háptico y README completo.
27 lines
740 B
Dart
27 lines
740 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:qrscanner/config/api_config.dart';
|
|
import 'package:qrscanner/models/auth_session.dart';
|
|
import 'package:qrscanner/models/scan_response.dart';
|
|
|
|
class PassCodeService {
|
|
Future<ScanResponse> scan({
|
|
required AuthSession session,
|
|
required String code,
|
|
}) async {
|
|
final response = await http.post(
|
|
Uri.parse(ApiConfig.scanUrl),
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': session.authorizationHeader,
|
|
},
|
|
body: jsonEncode({'code': code}),
|
|
);
|
|
|
|
final Map<String, dynamic> body =
|
|
jsonDecode(response.body) as Map<String, dynamic>;
|
|
|
|
return ScanResponse.fromJson(body);
|
|
}
|
|
} |