Created
September 2, 2021 16:58
-
-
Save warodri-sendbird/127b561198d8b99a511e5a2d7290499d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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