This commit is contained in:
Hamza-Ayed
2026-05-01 01:43:59 +03:00
parent cdda136006
commit 5fc160e374
25 changed files with 1526 additions and 1856 deletions

View File

@@ -18,11 +18,17 @@ class EmployeeController extends GetxController {
fetchEmployee() async {
var res = await CRUD().get(link: AppLink.getEmployee, payload: {});
if (res != 'failure') {
employee = jsonDecode(res)['message'];
if (res is String && (res == 'failure' || res == 'token_expired')) {
Get.snackbar('error', 'Failed to load employees', backgroundColor: AppColor.redColor);
return;
}
try {
var jsonData = res is String ? jsonDecode(res) : res;
employee = jsonData['message'];
update();
} else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
} catch (e) {
Get.snackbar('error', 'Invalid server response', backgroundColor: AppColor.redColor);
}
}