wt1.1.2d ProgressInfo+
This commit is contained in:
@@ -48,7 +48,7 @@ class CustomerApi {
|
||||
customer = Customer.fromJson(jsonDecode(responseBody));
|
||||
Cache().afterRegistration(customer);
|
||||
}
|
||||
} on FormatException catch (exception) {
|
||||
} on FormatException {
|
||||
throw new Exception(responseBody);
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class CustomerApi {
|
||||
try {
|
||||
customer = Customer.fromJson(jsonDecode(responseBody));
|
||||
await Cache().afterLogin(customer);
|
||||
} on FormatException catch (exception) {
|
||||
} on FormatException {
|
||||
throw new Exception(responseBody);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,18 @@ class ExerciseApi {
|
||||
body);
|
||||
}
|
||||
|
||||
Future<List<Exercise>> getExercisesByCustomer(int customerId ) async {
|
||||
final body = await _client.get("exercises/customer/", customerId.toString() );
|
||||
final Iterable json = jsonDecode(body);
|
||||
final List<Exercise> exercises = json.map( (exercise) {
|
||||
Exercise item = Exercise.fromJson(exercise);
|
||||
return item;
|
||||
}).toList();
|
||||
//exercises.sort( (a, b) => b.dateAdd.compareTo(a.dateAdd) );
|
||||
|
||||
return exercises;
|
||||
}
|
||||
|
||||
Future<Exercise> addExercise(Exercise exercise) async {
|
||||
String body = JsonEncoder().convert(exercise.toJson());
|
||||
print(" ===== add new exercise: " + body );
|
||||
@@ -32,12 +44,4 @@ class ExerciseApi {
|
||||
return savedExercise;
|
||||
}
|
||||
|
||||
Future<List<Exercise>> getExercisesByCustomer(int customerId ) async {
|
||||
final body = await _client.get("exercises/customer/", customerId.toString() );
|
||||
final Iterable json = jsonDecode(body);
|
||||
final List<Exercise> exercises = json.map( (exercise) => Exercise.fromJson(exercise) ).toList();
|
||||
|
||||
return exercises;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user