|
|
|
@ -42,6 +42,8 @@ class App extends Component { |
|
|
|
|
if (loginData['access_token']) { |
|
|
|
|
self.setState({ accessToken: loginData['access_token'] }); |
|
|
|
|
return this.state.accessToken; |
|
|
|
|
} else { |
|
|
|
|
throw new Error('no access token'); |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log('error: ' + e); |
|
|
|
@ -52,7 +54,12 @@ class App extends Component { |
|
|
|
|
|
|
|
|
|
getserverName = async () => { |
|
|
|
|
let coreUrl = ''; |
|
|
|
|
const currentpage = window.location.protocol+'//'+window.location.hostname+'/'; |
|
|
|
|
const currentPage = '//' + window.location.hostname + '/'; |
|
|
|
|
console.log('old currentPage=' + currentPage); |
|
|
|
|
if (currentPage.includes('-admin')) { |
|
|
|
|
currentPage = currentPage.replace(/-admin/g, ''); |
|
|
|
|
} |
|
|
|
|
console.log('new currentPage=' + currentPage); |
|
|
|
|
try { |
|
|
|
|
const configRequest = await fetch(currentpage + '/config.json'); |
|
|
|
|
const configData = JSON.parse(await configRequest.text()); |
|
|
|
@ -65,6 +72,7 @@ class App extends Component { |
|
|
|
|
console.log(coreUrl); |
|
|
|
|
this.setState({ homeserver: coreUrl + '/' }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onNameChange = (evt) => { |
|
|
|
|
this.setState({ userName: evt.target.value }); |
|
|
|
|
} |
|
|
|
|