Fix: connection problems checks

This commit is contained in:
2024-05-22 00:49:51 +03:00
parent d8e68f9b34
commit 46ba11cd57

View File

@@ -108,6 +108,7 @@ 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');
try {
var response = await http.post(url, body: { var response = await http.post(url, body: {
'GymKey': 'eeb42dcb-8e5b-4f21-825a-3fc7ada43445', 'GymKey': 'eeb42dcb-8e5b-4f21-825a-3fc7ada43445',
'id': '123' 'id': '123'
@@ -117,6 +118,9 @@ class _ExamplePageState extends State<ExamplePage> {
return ''; return '';
} }
return decodedBody['payload']['token']; return decodedBody['payload']['token'];
} catch (e) {
return '';
}
} }
@override @override