feat: Increase timeout duration for API requests and update relevant calls
This commit is contained in:
parent
44d72b73ac
commit
f834422c4e
@ -13,6 +13,7 @@ final Logger logger = Logger();
|
|||||||
class ApiService {
|
class ApiService {
|
||||||
static const Duration timeout = Duration(seconds: 10);
|
static const Duration timeout = Duration(seconds: 10);
|
||||||
static const bool enableLogs = true;
|
static const bool enableLogs = true;
|
||||||
|
static const Duration extendedTimeout = Duration(seconds: 60);
|
||||||
|
|
||||||
// === Helpers ===
|
// === Helpers ===
|
||||||
|
|
||||||
@ -208,8 +209,11 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final response =
|
final response = await _postRequest(
|
||||||
await _postRequest(ApiEndpoints.uploadAttendanceImage, body);
|
ApiEndpoints.uploadAttendanceImage,
|
||||||
|
body,
|
||||||
|
customTimeout: extendedTimeout,
|
||||||
|
);
|
||||||
if (response == null) return false;
|
if (response == null) return false;
|
||||||
|
|
||||||
final json = jsonDecode(response.body);
|
final json = jsonDecode(response.body);
|
||||||
@ -259,7 +263,12 @@ class ApiService {
|
|||||||
"gender": gender,
|
"gender": gender,
|
||||||
"jobRoleId": jobRoleId,
|
"jobRoleId": jobRoleId,
|
||||||
};
|
};
|
||||||
final response = await _postRequest(ApiEndpoints.createEmployee, body);
|
final response = await _postRequest(
|
||||||
|
ApiEndpoints.reportTask,
|
||||||
|
body,
|
||||||
|
customTimeout: extendedTimeout,
|
||||||
|
);
|
||||||
|
|
||||||
if (response == null) return false;
|
if (response == null) return false;
|
||||||
final json = jsonDecode(response.body);
|
final json = jsonDecode(response.body);
|
||||||
return response.statusCode == 200 && json['success'] == true;
|
return response.statusCode == 200 && json['success'] == true;
|
||||||
@ -309,7 +318,12 @@ class ApiService {
|
|||||||
if (images != null && images.isNotEmpty) "images": images,
|
if (images != null && images.isNotEmpty) "images": images,
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await _postRequest(ApiEndpoints.reportTask, body);
|
final response = await _postRequest(
|
||||||
|
ApiEndpoints.commentTask,
|
||||||
|
body,
|
||||||
|
customTimeout: extendedTimeout,
|
||||||
|
);
|
||||||
|
|
||||||
if (response == null) return false;
|
if (response == null) return false;
|
||||||
final json = jsonDecode(response.body);
|
final json = jsonDecode(response.body);
|
||||||
if (response.statusCode == 200 && json['success'] == true) {
|
if (response.statusCode == 200 && json['success'] == true) {
|
||||||
@ -414,15 +428,17 @@ class ApiService {
|
|||||||
DateTime? assignmentDate,
|
DateTime? assignmentDate,
|
||||||
required String categoryId,
|
required String categoryId,
|
||||||
}) async {
|
}) async {
|
||||||
final body = [{
|
final body = [
|
||||||
"parentTaskId": parentTaskId,
|
{
|
||||||
"plannedWork": plannedTask,
|
"parentTaskId": parentTaskId,
|
||||||
"comment": comment,
|
"plannedWork": plannedTask,
|
||||||
"workAreaID": workAreaId,
|
"comment": comment,
|
||||||
"activityID": activityId,
|
"workAreaID": workAreaId,
|
||||||
"workCategoryId": categoryId,
|
"activityID": activityId,
|
||||||
'completedWork': 0,
|
"workCategoryId": categoryId,
|
||||||
}];
|
'completedWork': 0,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
final response = await _postRequest(ApiEndpoints.assignTask, body);
|
final response = await _postRequest(ApiEndpoints.assignTask, body);
|
||||||
if (response == null) return false;
|
if (response == null) return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user