Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created December 7, 2021 09:16
Show Gist options
  • Save hieptl/2a941c0cc97a6260a0e91ff299dc0d37 to your computer and use it in GitHub Desktop.
Save hieptl/2a941c0cc97a6260a0e91ff299dc0d37 to your computer and use it in GitHub Desktop.
app.js - logout - Zocdoc Clone
const handleLogout = (navigation) => {
cometChat.logout().then(
() => {
AsyncStorage.removeItem('auth');
setUser(null);
navigation.reset({
index: 0,
routes: [{ name: 'Login' }]
});
}, error => {
console.log("Logout failed with exception:", { error });
}
);
};
const logout = (navigation) => () => {
Alert.alert(
"Confirm",
"Do you want to log out?",
[
{
text: "Cancel",
style: "cancel"
},
{ text: "OK", onPress: () => handleLogout(navigation) }
]
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment