fix rocket chat session

This commit is contained in:
Peter Maquiran
2022-01-29 20:34:36 +01:00
parent b06e155d20
commit eb504f5342
3 changed files with 19 additions and 18 deletions
-5
View File
@@ -133,11 +133,6 @@ export class AuthService {
localStorage.setItem('userChat', JSON.stringify(responseChat));
this.storageService.store(AuthConnstants.AUTH, responseChat);
if(window['setChatHeader']){
window['setChatHeader']()
}
return true;
}
+15 -11
View File
@@ -13,7 +13,7 @@ import { Observable, Subject } from "rxjs/Rx";
providedIn: 'root'
})
export class ChatService {
headers: HttpHeaders;
_headers: HttpHeaders;
options:any;
options1:any;
X_User_Id:any;
@@ -31,19 +31,23 @@ export class ChatService {
private storage: Storage,
private storageService:StorageService,
)
{
this.setHeader()
window['setChatHeader'] = this.setHeader
{}
get headers() {
this.loggedUserChat = this.authService.ValidatedUserChat;
this._headers = new HttpHeaders();
this._headers = this._headers.set('X-User-Id', this.loggedUserChat['data'].userId);
this._headers = this._headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
this.options = {
headers: this._headers,
};
return this._headers
}
setHeader = () => {
this.loggedUserChat = this.authService.ValidatedUserChat;
this.headers = new HttpHeaders();
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
this.options = {
headers: this.headers,
};
}
getDocumentDetails(url:string){
+4 -2
View File
@@ -602,11 +602,11 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
for (const [key, item] of Object.entries(this.wsMsgQueue)) {
if(item.loginRequired == true && this.isLogin == true) {
// console.log('run msgQueue ',index)
console.log('run msgQueue ', key)
this.ws.send(item);
delete this.wsMsgQueue[key]
} else if(item.loginRequired == false) {
// console.log('run msgQueue ',index)
console.log('run msgQueue ', key)
this.ws.send(item);
delete this.wsMsgQueue[key]
}
@@ -616,6 +616,8 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online
// console.log('save msgQueue this.ws.connected == false || loginRequired == true && this.isLogin == false',this.ws.connected, loginRequired, this.isLogin)
console.log('save msgQueue', requestId)
this.wsMsgQueue[requestId] = {message, requestId, loginRequired}
} else {
let messageStr = JSON.stringify(message)