add minimal errorcheck

main
Julian Gegner 2023-03-02 19:47:28 +01:00
parent 0e49b9cd32
commit 7bc9d4f35d
2 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,3 @@
import 'package:smoke_cess_app/interface/db_record.dart';
import 'package:smoke_cess_app/models/mood.dart'; import 'package:smoke_cess_app/models/mood.dart';
import 'package:smoke_cess_app/models/relapse.dart'; import 'package:smoke_cess_app/models/relapse.dart';
import 'package:smoke_cess_app/models/sleep.dart'; import 'package:smoke_cess_app/models/sleep.dart';

View File

@ -31,13 +31,13 @@ class ExportService {
}; };
} }
void exportData() async { Future<int> exportData() async {
Map<String, List<String>> body = await _loadRecords(); Map<String, List<String>> body = await _loadRecords();
final response = await http.post(url, final response = await http.post(url,
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
}, },
body: jsonEncode(body)); body: jsonEncode(body));
print(response.statusCode); return response.statusCode >= 400 ? 0 : 1;
} }
} }