refactor: upgrade API endpoints to v3 and refactor navigation and response handling across controllers
This commit is contained in:
@@ -230,8 +230,16 @@ ${'Download the Intaleq app now and enjoy your ride!'.tr}
|
||||
Get.snackbar('Success'.tr, 'Invite sent successfully'.tr,
|
||||
backgroundColor: Colors.green, colorText: Colors.white);
|
||||
|
||||
String expirationTime = d['message']['expirationTime'].toString();
|
||||
String inviteCode = d['message']['inviteCode'].toString();
|
||||
// التحقق الديناميكي من مكان البيانات (V1 vs V3)
|
||||
var payload = d['data'] ?? d['message'];
|
||||
|
||||
// إذا كان الـ message نصاً وليس خريطة (Map)، نأخذ البيانات من المستوى الأعلى
|
||||
if (payload is String) {
|
||||
payload = d;
|
||||
}
|
||||
|
||||
String expirationTime = (payload['expirationTime'] ?? '').toString();
|
||||
String inviteCode = (payload['inviteCode'] ?? '').toString();
|
||||
|
||||
// New and improved WhatsApp message for better user engagement.
|
||||
String message =
|
||||
|
||||
@@ -26,8 +26,8 @@ class OrderHistoryController extends GetxController {
|
||||
update();
|
||||
} else {
|
||||
var jsonDecoded = jsonDecode(res);
|
||||
|
||||
orderHistoryListPassenger = jsonDecoded['data'];
|
||||
var rawData = jsonDecoded['data'] ?? jsonDecoded['message'];
|
||||
orderHistoryListPassenger = rawData is List ? rawData : [];
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user