refactor: update getSDUIForm method to require token parameter, enhance error handling in SDUIFormWidget, and clean up code formatting across various files
This commit is contained in:
@@ -27,7 +27,7 @@ class NewInspectionLogic extends GetxController {
|
||||
RxnString searchedValue = RxnString();
|
||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
@@ -13,5 +13,7 @@ abstract class VetFarmRemoteDataSource {
|
||||
required SubmitInspectionResponse request,
|
||||
});
|
||||
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({String? token});
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({
|
||||
required String token,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,18 +38,16 @@ class VetFarmRemoteDataSourceImpl implements VetFarmRemoteDataSource {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({String? token}) async {
|
||||
DioRemote dio = DioRemote(baseUrl: "http://testbackend.rasadyaar.ir/");
|
||||
await dio.init();
|
||||
|
||||
|
||||
var res = await dio.get(
|
||||
'inspection_form_sd_ui/',
|
||||
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({
|
||||
required String token,
|
||||
}) async {
|
||||
var res = await _httpClient.get(
|
||||
'/inspection_form_sd_ui/?name=b1',
|
||||
headers: {'Authorization': 'Bearer $token'},
|
||||
fromJson: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return res;
|
||||
},
|
||||
);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,5 +14,7 @@ abstract class VetFarmRepository {
|
||||
});
|
||||
|
||||
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({String? token});
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({
|
||||
required String token,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class VetFarmRepositoryImpl implements VetFarmRepository {
|
||||
return await _remote.submitInspection(token: token, request: request);
|
||||
}
|
||||
@override
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({String? token}) async {
|
||||
Future<DioResponse<Map<String, dynamic>>> getSDUIForm({required String token,}) async {
|
||||
return await _remote.getSDUIForm(token: token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ class NewPageLogic extends GetxController {
|
||||
|
||||
Future<void> getSDUIForm() async {
|
||||
await safeCall(
|
||||
call: () async => await rootLogic.vetFarmRepository.getSDUIForm(),
|
||||
call: () async => await rootLogic.vetFarmRepository.getSDUIForm(
|
||||
token: rootLogic.tokenService.accessToken.value ?? '',
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result.data != null) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user