add headers to options

This commit is contained in:
Peter Maquiran
2021-08-24 14:07:27 +01:00
parent 567209ed4b
commit 019b85d209
16 changed files with 184 additions and 32 deletions
+46
View File
@@ -0,0 +1,46 @@
import { Injectable } from '@angular/core';
import { localstoreService } from '../localstore.service'
import { SHA1 } from 'crypto-js'
@Injectable({
providedIn: 'root'
})
export class ChatUserService {
// main data
private _userList = []
// local storage keyName
private keyName: string;
constructor() {
this.keyName = ('chat'+SHA1(this.constructor.name)).toString()
setTimeout(()=>{
let restore = localstoreService.get(this.keyName, [])
this._userList = restore.userList
}, 10)
}
get userList() {
return this._userList
}
reset(userList: any[]) {
this._userList = userList
this.save()
}
private save() {
setTimeout(()=> {
localstoreService.set(this.keyName, {
userList: this._userList
})
}, 10)
}
}
export const ChatUserStorage = new ChatUserService()