Merge pull request #128 from Empty2k12/fix/no-public-rooms

Improve message when there are no public rooms on a server
This commit is contained in:
Ajay Bura 2021-10-03 10:00:23 +05:30 committed by GitHub
commit 0f02bfd2c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,14 +139,20 @@ function PublicRooms({ isOpen, searchTerm, onRequestClose }) {
updateIsViewMore(false); updateIsViewMore(false);
if (totalRooms.length === 0) { if (totalRooms.length === 0) {
updateSearchQuery({ updateSearchQuery({
error: `No result found for "${inputRoomName}" on ${inputHs}`, error: inputRoomName === ''
? `No public rooms on ${inputHs}`
: `No result found for "${inputRoomName}" on ${inputHs}`,
alias: isInputAlias ? inputRoomName : null, alias: isInputAlias ? inputRoomName : null,
}); });
} }
} catch (e) { } catch (e) {
updatePublicRooms([]); updatePublicRooms([]);
let err = 'Something went wrong!';
if (e?.httpStatus >= 400 && e?.httpStatus < 500) {
err = e.message;
}
updateSearchQuery({ updateSearchQuery({
error: 'Something went wrong!', error: err,
alias: isInputAlias ? inputRoomName : null, alias: isInputAlias ? inputRoomName : null,
}); });
updateIsSearching(false); updateIsSearching(false);