continue to hook up server

This commit is contained in:
or-else
2016-01-10 14:07:25 -08:00
parent eba7510be8
commit d28c696190
+13 -7
View File
@@ -253,7 +253,7 @@
case 'settings': case 'settings':
title = "Settings"; break; title = "Settings"; break;
case 'contacts': case 'contacts':
title = "Alice Johnson"; title = this.props.title;
avatar = true; avatar = true;
default:; default:;
}; };
@@ -557,15 +557,16 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
getInitialState: function() { getInitialState: function() {
return { return {
sidePanel: 'login', sidePanel: 'login',
sideTitle: 'not set',
loggedIn: false, loggedIn: false,
errorText: '', errorText: '',
selTopic: '', selectedTopicName: '',
loginDisabled: false loginDisabled: false
}; };
}, },
componentDidMount: function() { componentDidMount: function() {
Tinode.enableLogging(true); Tinode.enableLogging(true);
// Setup with default transport // Setup with default transport.
Tinode.setup(HOST, API_KEY); Tinode.setup(HOST, API_KEY);
}, },
handleLogin: function(login, password) { handleLogin: function(login, password) {
@@ -575,8 +576,12 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
return Tinode.loginBasic(login, password); return Tinode.loginBasic(login, password);
}).then(function() { }).then(function() {
instance.setState({loggedIn: true}); instance.setState({loggedIn: true});
var me = new Tinode.Topic("me"); var me = Tinode.getMeTopic();
me.subscribe(); // Subscribe, fetch topic info and the list of subscriptions.
return me.subscribe({get: "info sub"});
}).then(function() {
var me = Tinode.getMeTopic();
instance.setState({sidePanel: "contacts", sideTitle: me.public});
}).catch(function(err) { }).catch(function(err) {
instance.setState({loginDisabled: false, errorText: err.message}); instance.setState({loginDisabled: false, errorText: err.message});
}); });
@@ -585,7 +590,7 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
}, },
handleTopicSelected: function(topic) { handleTopicSelected: function(topic) {
this.setState({selTopic: topic}); this.setState({selectedTopicName: topic});
}, },
handleSignUp: function() { handleSignUp: function() {
this.setState({sidePanel: 'register'}); this.setState({sidePanel: 'register'});
@@ -607,6 +612,7 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
<div id="sidebar-wrapper"> <div id="sidebar-wrapper">
<SidepanelView <SidepanelView
state={this.state.sidePanel} state={this.state.sidePanel}
title={this.state.sideTitle}
loginDisabled={this.state.loginDisabled} loginDisabled={this.state.loginDisabled}
errorText={this.state.errorText} errorText={this.state.errorText}
onSignUp={this.handleSignUp} onSignUp={this.handleSignUp}
@@ -622,7 +628,7 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
<div className="row fullHeight"> <div className="row fullHeight">
<div className="col-lg-12 fullHeight"> <div className="col-lg-12 fullHeight">
{this.state.selTopic ? {this.state.selTopic ?
<MessagesView topic={this.state.selTopic} /> : <MessagesView topic={this.state.selectedTopicName} /> :
<DummyMessagesView />} <DummyMessagesView />}
</div> </div>
</div> </div>