From 7bc9d4f35d08076036826f26c62d7bdf19b20f4a Mon Sep 17 00:00:00 2001 From: Crondung <1922635@stud.hs-mannheim.de> Date: Thu, 2 Mar 2023 19:47:28 +0100 Subject: [PATCH] add minimal errorcheck --- lib/mock/db_mock.dart | 1 - lib/services/export_service.dart | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/mock/db_mock.dart b/lib/mock/db_mock.dart index dac8c9f..4e5d0e6 100644 --- a/lib/mock/db_mock.dart +++ b/lib/mock/db_mock.dart @@ -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/relapse.dart'; import 'package:smoke_cess_app/models/sleep.dart'; diff --git a/lib/services/export_service.dart b/lib/services/export_service.dart index 12afa12..9758270 100644 --- a/lib/services/export_service.dart +++ b/lib/services/export_service.dart @@ -31,13 +31,13 @@ class ExportService { }; } - void exportData() async { + Future exportData() async { Map> body = await _loadRecords(); final response = await http.post(url, headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode(body)); - print(response.statusCode); + return response.statusCode >= 400 ? 0 : 1; } }