Skip to content

Instantly share code, notes, and snippets.

@warodri-sendbird
Created September 2, 2021 16:58
Show Gist options
  • Save warodri-sendbird/127b561198d8b99a511e5a2d7290499d to your computer and use it in GitHub Desktop.
Save warodri-sendbird/127b561198d8b99a511e5a2d7290499d to your computer and use it in GitHub Desktop.
const next = () => {
if (query.hasNext) {
dispatch({ type: 'start-loading' });
query.limit = 20;
query.next((err, fetchedChannels) => {
dispatch({ type: 'end-loading' });
if (!err) {
dispatch({
type: 'fetch-channels',
payload: { channels: fetchedChannels }
});
} else {
dispatch({
type: 'error',
payload: {
error: 'Failed to get the channels.'
}
});
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment