WT1.1.0+41 error fixing
This commit is contained in:
@@ -11,6 +11,7 @@ class CustomerExerciseDeviceApi with Logging {
|
||||
Future<List<CustomerExerciseDevice>> getDevices(int customerId) async {
|
||||
List<CustomerExerciseDevice> devices;
|
||||
try {
|
||||
log(" --- get customer_exercise_devices: ");
|
||||
final body = await _client.get("customer_exercise_device/customer/" + customerId.toString(), "");
|
||||
final Iterable json = jsonDecode(body);
|
||||
devices = json.map((device) => CustomerExerciseDevice.fromJson(device)).toList();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/purchase.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/util/not_found_exception.dart';
|
||||
import 'dart:convert';
|
||||
import 'api.dart';
|
||||
|
||||
@@ -8,10 +9,15 @@ class PurchaseApi with Logging {
|
||||
final APIClient _client = new APIClient();
|
||||
|
||||
Future<List<Purchase>> getPurchasesByCustomer(int customerId) async {
|
||||
final body = await _client.get("purchase/customer/" + customerId.toString(), "");
|
||||
final Iterable json = jsonDecode(body);
|
||||
final List<Purchase> purchases = json.map((purchase) => Purchase.fromJson(purchase)).toList();
|
||||
Cache().setPurchases(purchases);
|
||||
List<Purchase> purchases = List();
|
||||
try {
|
||||
final body = await _client.get("purchase/customer/" + customerId.toString(), "");
|
||||
final Iterable json = jsonDecode(body);
|
||||
final List<Purchase> purchases = json.map((purchase) => Purchase.fromJson(purchase)).toList();
|
||||
Cache().setPurchases(purchases);
|
||||
} on NotFoundException catch (e) {
|
||||
log("No purchases found");
|
||||
}
|
||||
return purchases;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user