update admin app endpoint and ensure chatbox closes even if leaveRoom fails

This commit is contained in:
Sharon Kennedy
2021-01-20 22:44:53 -05:00
parent 40e968fcee
commit bf29508e8c
6 changed files with 33 additions and 30 deletions

View File

@@ -151,23 +151,28 @@ class ChatBox extends React.Component {
exitChat = async (resetState=true) => {
if (this.state.client) {
await this.state.client.leave(this.state.roomId)
try {
await this.state.client.leave(this.state.roomId)
const auth = {
type: 'm.login.password',
user: this.state.userId,
identifier: {
type: "m.id.user",
user: this.state.userId,
},
password: this.state.password,
};
const auth = {
type: 'm.login.password',
user: this.state.userId,
identifier: {
type: "m.id.user",
user: this.state.userId,
},
password: this.state.password,
};
await this.state.client.deactivateAccount(auth, true)
await this.state.client.stopClient()
await this.state.client.clearStores()
this.setState({ client: null, ready: true }) // no more loading animation
window.clearInterval(this.state.waitIntervalId) // no more waiting messages
await this.state.client.deactivateAccount(auth, true)
await this.state.client.stopClient()
await this.state.client.clearStores()
} catch (err) {
console.log("Error exiting chat", err)
} finally {
this.setState({ client: null, ready: true }) // no more loading animation
window.clearInterval(this.state.waitIntervalId) // no more waiting messages
}
}
if (this.state.localStorage) {

View File

@@ -1 +1 @@
export const DEFAULT_SETTINGS_ENDPOINT = 'https://safesupport-admin.herokuapp.com/api/get-settings';
export const DEFAULT_SETTINGS_ENDPOINT = 'https://admin.safesupport.chat/api/get-settings';