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 {
|
||||
static const Duration timeout = Duration(seconds: 10);
|
||||
static const bool enableLogs = true;
|
||||
static const Duration extendedTimeout = Duration(seconds: 60);
|
||||
|
||||
// === Helpers ===
|
||||
|
||||
@ -208,8 +209,11 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
final response =
|
||||
await _postRequest(ApiEndpoints.uploadAttendanceImage, body);
|
||||
final response = await _postRequest(
|
||||
ApiEndpoints.uploadAttendanceImage,
|
||||
body,
|
||||
customTimeout: extendedTimeout,
|
||||
);
|
||||
if (response == null) return false;
|
||||
|
||||
final json = jsonDecode(response.body);
|
||||
@ -259,7 +263,12 @@ class ApiService {
|
||||
"gender": gender,
|
||||
"jobRoleId": jobRoleId,
|
||||
};
|
||||
final response = await _postRequest(ApiEndpoints.createEmployee, body);
|
||||
final response = await _postRequest(
|
||||
ApiEndpoints.reportTask,
|
||||
body,
|
||||
customTimeout: extendedTimeout,
|
||||
);
|
||||
|
||||
if (response == null) return false;
|
||||
final json = jsonDecode(response.body);
|
||||
return response.statusCode == 200 && json['success'] == true;
|
||||
@ -309,7 +318,12 @@ class ApiService {
|
||||
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;
|
||||
final json = jsonDecode(response.body);
|
||||
if (response.statusCode == 200 && json['success'] == true) {
|
||||
@ -414,15 +428,17 @@ class ApiService {
|
||||
DateTime? assignmentDate,
|
||||
required String categoryId,
|
||||
}) async {
|
||||
final body = [{
|
||||
"parentTaskId": parentTaskId,
|
||||
"plannedWork": plannedTask,
|
||||
"comment": comment,
|
||||
"workAreaID": workAreaId,
|
||||
"activityID": activityId,
|
||||
"workCategoryId": categoryId,
|
||||
'completedWork': 0,
|
||||
}];
|
||||
final body = [
|
||||
{
|
||||
"parentTaskId": parentTaskId,
|
||||
"plannedWork": plannedTask,
|
||||
"comment": comment,
|
||||
"workAreaID": workAreaId,
|
||||
"activityID": activityId,
|
||||
"workCategoryId": categoryId,
|
||||
'completedWork': 0,
|
||||
}
|
||||
];
|
||||
|
||||
final response = await _postRequest(ApiEndpoints.assignTask, body);
|
||||
if (response == null) return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user