Fixed test server reachability

This commit is contained in:
Juan Gilsanz Polo
2024-02-26 23:13:21 +01:00
parent c7c8fca3e7
commit 89c6b4aa09

View File

@@ -11,8 +11,13 @@ import 'package:linkdy/models/server_instance.dart';
Future<bool> testServerReachability(String url) async { Future<bool> testServerReachability(String url) async {
try { try {
await Dio().get(url); await Dio(BaseOptions(connectTimeout: const Duration(seconds: 5))).get("$url/api/");
return true; return true;
} on DioException catch (e) {
if (e.response?.statusCode != null) {
return true;
}
return false;
} catch (e) { } catch (e) {
return false; return false;
} }