Browse Source

let userid work with and without @

f0x 1 week ago
parent
commit
36876be123
2 changed files with 5 additions and 2 deletions
  1. 1
    0
      app.js
  2. 4
    2
      components/Login.js

+ 1
- 0
app.js View File

@@ -42,6 +42,7 @@ let App = create({
42 42
   },
43 43
 
44 44
   loginCallback: function(userId, accessToken, apiUrl) {
45
+    userId = '@' + userId.replace('@', '')
45 46
     let backend = new Matrix(userId, accessToken, apiUrl)
46 47
     this.setState({
47 48
       backend: backend

+ 4
- 2
components/Login.js View File

@@ -67,9 +67,11 @@ let login = create({
67 67
     }).then((response) => response.json())
68 68
     .then((responseJson) => {
69 69
       console.log("got access token", responseJson)
70
-      this.setState({json: responseJson});
70
+      this.setState({json: responseJson})
71 71
       if(responseJson.access_token != undefined) {
72
-        this.props.callback(user, responseJson.access_token, hs)
72
+        this.props.callback(responseJson.user_id, responseJson.access_token, hs)
73
+      } else {
74
+        this.setState({error: responseJson.error})
73 75
       }
74 76
     })
75 77
     .catch((error) => {

Loading…
Cancel
Save