Fix: connection problems checks
This commit is contained in:
@@ -108,15 +108,19 @@ class _ExamplePageState extends State<ExamplePage> {
|
|||||||
Future<String> _getToken() async {
|
Future<String> _getToken() async {
|
||||||
var url =
|
var url =
|
||||||
Uri.http('gymlink.freemyip.com:8080', 'api/auth/authorize_client');
|
Uri.http('gymlink.freemyip.com:8080', 'api/auth/authorize_client');
|
||||||
var response = await http.post(url, body: {
|
try {
|
||||||
'GymKey': 'eeb42dcb-8e5b-4f21-825a-3fc7ada43445',
|
var response = await http.post(url, body: {
|
||||||
'id': '123'
|
'GymKey': 'eeb42dcb-8e5b-4f21-825a-3fc7ada43445',
|
||||||
}); // Just testing token
|
'id': '123'
|
||||||
var decodedBody = jsonDecode(response.body) as Map;
|
}); // Just testing token
|
||||||
if (decodedBody['payload'] == null) {
|
var decodedBody = jsonDecode(response.body) as Map;
|
||||||
|
if (decodedBody['payload'] == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return decodedBody['payload']['token'];
|
||||||
|
} catch (e) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return decodedBody['payload']['token'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user