fixed chat search
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
@ -26,6 +27,7 @@ class AutocompleteApi {
|
|||||||
var response = await http.get(endpoint, headers: headers);
|
var response = await http.get(endpoint, headers: headers);
|
||||||
if(response.statusCode != HttpStatus.ok) throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
if(response.statusCode != HttpStatus.ok) throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
||||||
var result = response.body;
|
var result = response.body;
|
||||||
|
log(response.body);
|
||||||
return AutocompleteResponse.fromJson(jsonDecode(result)['ocs']);
|
return AutocompleteResponse.fromJson(jsonDecode(result)['ocs']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class AutocompleteResponseObject {
|
|||||||
String label;
|
String label;
|
||||||
String? icon;
|
String? icon;
|
||||||
String? source;
|
String? source;
|
||||||
List<String>? status;
|
String? status;
|
||||||
String? subline;
|
String? subline;
|
||||||
String? shareWithDisplayNameUniqe;
|
String? shareWithDisplayNameUniqe;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ AutocompleteResponseObject _$AutocompleteResponseObjectFromJson(
|
|||||||
json['label'] as String,
|
json['label'] as String,
|
||||||
json['icon'] as String?,
|
json['icon'] as String?,
|
||||||
json['source'] as String?,
|
json['source'] as String?,
|
||||||
(json['status'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
json['status'] as String?,
|
||||||
json['subline'] as String?,
|
json['subline'] as String?,
|
||||||
json['shareWithDisplayNameUniqe'] as String?,
|
json['shareWithDisplayNameUniqe'] as String?,
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:async/async.dart';
|
import 'package:async/async.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ class JoinChat extends SearchDelegate<String> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else if(snapshot.hasError) {
|
} else if(snapshot.hasError) {
|
||||||
|
log(snapshot.error.toString());
|
||||||
return const PlaceholderView(icon: Icons.search_off, text: 'Ein fehler ist aufgetreten. Bist du mit dem Internet verbunden?');
|
return const PlaceholderView(icon: Icons.search_off, text: 'Ein fehler ist aufgetreten. Bist du mit dem Internet verbunden?');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user