Created
October 10, 2021 16:19
-
-
Save hieptl/1791b7f821afff8b940e9ad742d07998 to your computer and use it in GitHub Desktop.
login.js - Login CometChat - React Native Gifted Chat App
This file contains hidden or 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
... | |
cometChat.login(firebaseUid, `${cometChatConfig.cometChatAuthKey}`).then( | |
user => { | |
// User loged in successfully. | |
// save authenticated user to local storage. | |
AsyncStorage.setItem('auth', JSON.stringify(user)); | |
// save authenticated user to context. | |
setUser(user); | |
// navigate to the home page | |
navigation.navigate('Home'); | |
}, | |
error => { | |
// User login failed, check error and take appropriate action. | |
setIsLoading(false); | |
showMessage('Error', 'Your username or password is not correct'); | |
} | |
); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment