frontend: fix error toast when the server returns no messages
This commit is contained in:
parent
871ed87687
commit
96da377e4e
1 changed files with 3 additions and 1 deletions
|
@ -176,7 +176,9 @@ class MessageStore extends Store {
|
||||||
const oldestMessage = this.value[0];
|
const oldestMessage = this.value[0];
|
||||||
const endpoint = oldestMessage ? `channels/${this.channelId}/messages/?before=${oldestMessage.id}` : `channels/${this.channelId}/messages`;
|
const endpoint = oldestMessage ? `channels/${this.channelId}/messages/?before=${oldestMessage.id}` : `channels/${this.channelId}/messages`;
|
||||||
const res = await request("GET", apiRoute(endpoint), true, null);
|
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)
|
if (beforeCommitToStore)
|
||||||
beforeCommitToStore(res.json);
|
beforeCommitToStore(res.json);
|
||||||
res.json.reverse();
|
res.json.reverse();
|
||||||
|
|
Loading…
Reference in a new issue