Fix go back

This commit is contained in:
Peter Maquiran
2021-08-25 09:38:13 +01:00
parent 7c2a2152e9
commit 54ee7701c8
3 changed files with 20 additions and 26 deletions
+6 -5
View File
@@ -8,7 +8,7 @@ import { SHA1 } from 'crypto-js'
export class ChatUserService {
// main data
private _userList = []
private _userList = {}
// local storage keyName
private keyName: string;
@@ -17,8 +17,8 @@ export class ChatUserService {
this.keyName = ('chat'+SHA1(this.constructor.name)).toString()
setTimeout(()=>{
let restore = localstoreService.get(this.keyName, [])
this._userList = restore.userList
let restore = localstoreService.get(this.keyName, {})
this._userList = restore.userList || {}
}, 10)
}
@@ -27,8 +27,9 @@ export class ChatUserService {
return this._userList
}
reset(userList: any[]) {
this._userList = userList
add(roomId:string, userList: any[] = []) {
this._userList[roomId] = userList
this.save()
}