|
|
|
@ -36,8 +36,18 @@ class Location {
|
|
|
|
|
"id": actualUser,
|
|
|
|
|
});
|
|
|
|
|
var data = jsonDecode(response.body);
|
|
|
|
|
data.forEach((s)=> spot.putIfAbsent(s['user'], () => s['music']));
|
|
|
|
|
return spot;
|
|
|
|
|
if (data.runtimeType==String) {
|
|
|
|
|
if (data=="Failed to connect to MySQL, connection timeout"){
|
|
|
|
|
return Future.error("Failed to connect to MySQL, connection timeout");
|
|
|
|
|
}else if (data=="The POST didn't return any values"){
|
|
|
|
|
return Future.error("POST method failed");
|
|
|
|
|
}else{
|
|
|
|
|
return Future.error("Can't find current user in the database");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
data.forEach((s) => spot.putIfAbsent(s['user'], () => s['music']));
|
|
|
|
|
return spot;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|