Better error handling in fetch data

This commit is contained in:
Vicente J. Ruiz Jurado 2018-08-14 08:55:14 +02:00
parent 1a2cdfd814
commit d3cd6012e6
3 changed files with 17 additions and 21 deletions

View file

@ -47,9 +47,10 @@ class FiresApi {
final mobileToken = state.user.token;
final String url = '${state
.firesApiUrl}mobile/subscriptions/all/$apiKey/$mobileToken';
// if (globals.isDevelopment) print('$url');
return await resty.get(url).go().then((response) {
if (response.statusCode == 200) {
// print(response.body);
// if (globals.isDevelopment) print(response.body);
final dataSubscriptions =
json.decode(response.body)['data']['subscriptions'];
List<YourLocation> subscribed = [];