Skip to content

Instantly share code, notes, and snippets.

@warodri-sendbird
Created September 3, 2021 08:38
Show Gist options
  • Save warodri-sendbird/710552845828c264feca5468e37d57e1 to your computer and use it in GitHub Desktop.
Save warodri-sendbird/710552845828c264feca5468e37d57e1 to your computer and use it in GitHub Desktop.
const next = () => {
if (query.hasMore) {
dispatch({ type: 'error', payload: { error: '' } });
query.limit = 50;
query.reverse = true;
query.load((err, fetchedMessages) => {
if (!err) {
dispatch({ type: 'fetch-messages', payload: { messages: fetchedMessages } });
} else {
dispatch({ type: 'error', payload: { error: 'Failed to get the messages.' } });
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment