Přidat fail jako chybu

This commit is contained in:
Matyáš Caras 2022-04-09 17:52:54 +02:00
parent ee6ad69d66
commit c3333fca95
2 changed files with 3 additions and 3 deletions

View file

@ -156,7 +156,7 @@ class Canteen {
? "; " + cookies["remember-me"]! + ";"
: ";"),
});
if (r.statusCode != 200) {
if (r.statusCode != 200 || r.body.contains("fail")) {
return Future.error("Chyba: ${r.body}");
}
if (r.headers.containsKey("set-cookie")) {
@ -455,7 +455,7 @@ class Canteen {
/// - [bool], `true`, pokud bylo jídlo úspěšně objednáno z burzy, jinak `false`
Future<bool> objednatZBurzy(Burza b) async {
if (!prihlasen) return Future.error("Uživatel není přihlášen");
var res = await _getRequest("/faces/secured/" + b.url!);
var res = await _getRequest("/faces/secured/" + b.url!); // TODO: SPRAVIT
if (res.contains("Chyba")) return false;
return true;
}

View file

@ -1,6 +1,6 @@
name: canteenlib
description: Library for communication with the czech canteen food ordering system iCanteen
version: 0.1.0-alpha.14
version: 0.1.0-alpha.15
repository: 'https://github.com/hernikplays/canteenlib'
issue_tracker: 'https://github.com/hernikplays/canteenlib/issues'
documentation: 'https://docs.hernikplays.cz'