step 9 : listing history scan dan pull to refresh, perbaikan auth model add host
This commit is contained in:
@@ -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"]),
|
||||
);
|
||||
|
||||
22
lib/repository/scan_repository.dart
Normal file
22
lib/repository/scan_repository.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user