Skip to content

Instantly share code, notes, and snippets.

@adelowo adelowo/gdpr-App.js Secret
Created Mar 17, 2020

Embed
What would you like to do?
import React, { Component } from "react";
import "./App.css";
import "bootstrap/dist/css/bootstrap.min.css";
import "stream-chat-react/dist/css/index.css";
import Login from "./Login";
import ChatView from "./ChatView";
import { StreamChat } from "stream-chat";
export default class App extends Component {
state = { isAuthenticated: false };
constructor(props) {
super(props);
this.chatClient = new StreamChat("STREAM_CHAT_API_KEY");
}
setUser = (user, token) => {
this.chatClient.setUser(user, token);
this.setState({ isAuthenticated: true });
};
render() {
return (
<div className="App">
<header className="App-header">
{this.state.isAuthenticated ? (
<ChatView chatClient={this.chatClient} />
) : (
<Login cb={this.setUser} />
)}
</header>
</div>
);
}
}
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.