frontend: fix error toast when the server returns no messages

This commit is contained in:
hippoz 2022-04-26 04:00:18 +03:00
parent 871ed87687
commit 96da377e4e
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -176,7 +176,9 @@ class MessageStore extends Store {
const oldestMessage = this.value[0];
const endpoint = oldestMessage ? `channels/${this.channelId}/messages/?before=${oldestMessage.id}` : `channels/${this.channelId}/messages`;
const res = await request("GET", apiRoute(endpoint), true, null);
if (res.success && res.ok && res.json && res.json.length > 0) {
if (res.success && res.ok && res.json) {
if (res.json.length < 1)
return;
if (beforeCommitToStore)
beforeCommitToStore(res.json);
res.json.reverse();