step 9 : listing history scan dan pull to refresh, perbaikan auth model add host

This commit is contained in:
sindhu
2025-02-15 22:04:19 +07:00
parent 32abcb60dc
commit e90c710333
10 changed files with 378 additions and 122 deletions

View File

@@ -11,10 +11,11 @@ class AuthRepository extends BaseRepository {
}) async {
final param = {"username": username, "password": password};
// final service = "${Constant.baseUrl}xauth/login";
final service = "http://${host}/one-api/v1/system/auth/login";
final service = "http://$host/one-api/v1/system/auth/login";
final resp = await post(param: param, service: service);
final result = AuthModel(
host: host,
token: resp["data"]["token"],
model: UserModel.fromJson(resp["data"]["user"]),
);

View File

@@ -0,0 +1,22 @@
import '../model/person_ktp_model.dart';
import 'base_repository.dart';
class ScanRepository extends BaseRepository {
ScanRepository({required super.dio});
Future<List<PersonKtp>> listRiwayatScanRepo({
required String host,
}) async {
// final service = "${Constant.baseUrl}xauth/login";
final service = "http://${host}/one-api/scan-ktp/Scanktp/listRiwayatScan";
final resp = await post(param: {}, service: service);
final result = List<PersonKtp>.empty(growable: true);
resp['data'].forEach((e) {
final model = PersonKtp.fromJson(e);
result.add(model);
});
return result;
}
}