mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix rocket chat session
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user