From 39988fdc15b17946984aff5c897168d5985d506b Mon Sep 17 00:00:00 2001 From: Matthew Patrick Date: Sun, 22 May 2022 16:51:01 +0700 Subject: [PATCH] API - Fixed getTransactions error crashing the whole app --- lib/api/api.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/api/api.dart b/lib/api/api.dart index 137a6f8..a77e1d7 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -63,8 +63,15 @@ Future getSessions(session) async { } Future getTransactions(session) async { - var req = await Dio() - .post('$host/transaction', queryParameters: {'session_token': session}); + var req = await Dio().post( + '$host/transaction', + queryParameters: {'session_token': session}, + options: Options( + validateStatus: (status) { + return status! < 500; + }, + ), + ); var res = req.data; return res; }