Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
React Native Stream Group Chat Tutorial: Login code
// src/screens/Login.js
login = async () => {
const username = this.state.username;
this.setState({
is_loading: true
});
if (username) {
try {
const user_id = StringHash(username).toString();
const response = await axios.post(`${CHAT_SERVER}/auth`, {
user_id
});
this.props.navigation.navigate("Chat", {
user_id,
username,
user_token: response.data.token
});
} catch (err) {
console.log("error: ", err);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.