wt1.1.2d ProgressInfo+

This commit is contained in:
Bossanyi Tibor
2020-10-09 07:54:54 +02:00
parent 0cdc3a9d24
commit 35f0d0042f
66 changed files with 1615 additions and 576 deletions
+2 -2
View File
@@ -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);
}
}
+12 -8
View File
@@ -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;
}
}