From d28c696190511f2d894a0e1700a634f5d295e20e Mon Sep 17 00:00:00 2001 From: or-else Date: Sun, 10 Jan 2016 14:07:25 -0800 Subject: [PATCH] continue to hook up server --- index.html | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index ac5d2bd5..98fecb3e 100644 --- a/index.html +++ b/index.html @@ -253,7 +253,7 @@ case 'settings': title = "Settings"; break; case 'contacts': - title = "Alice Johnson"; + title = this.props.title; avatar = true; default:; }; @@ -557,15 +557,16 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab getInitialState: function() { return { sidePanel: 'login', + sideTitle: 'not set', loggedIn: false, errorText: '', - selTopic: '', + selectedTopicName: '', loginDisabled: false }; }, componentDidMount: function() { Tinode.enableLogging(true); - // Setup with default transport + // Setup with default transport. Tinode.setup(HOST, API_KEY); }, 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); }).then(function() { instance.setState({loggedIn: true}); - var me = new Tinode.Topic("me"); - me.subscribe(); + var me = Tinode.getMeTopic(); + // 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) { 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) { - this.setState({selTopic: topic}); + this.setState({selectedTopicName: topic}); }, handleSignUp: function() { this.setState({sidePanel: 'register'}); @@ -607,6 +612,7 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab