mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix logout
This commit is contained in:
@@ -469,7 +469,7 @@ export class RoomService {
|
||||
|
||||
|
||||
deleteAll() {
|
||||
this.messages.forEach((message)=>{
|
||||
this.messages.forEach((message) => {
|
||||
if(message?._id) {
|
||||
this.sendDeleteRequest(message._id)
|
||||
}
|
||||
@@ -478,7 +478,7 @@ export class RoomService {
|
||||
|
||||
async delateMessageToSendToOthers(userId) {
|
||||
|
||||
const deleteMessage = await DeleteMessageModel.all()
|
||||
const deleteMessage = await DeleteMessageModel.all();
|
||||
|
||||
const toSend = deleteMessage.filter((DeleteMessage:string[])=> ! DeleteMessage.includes(userId))
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import { SortService } from '../functions/sort.service';
|
||||
import { chatUser } from 'src/app/models/chatMethod';
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
import { ChangeProfileService } from '../change-profile.service';
|
||||
import { AuthService } from '../auth.service';
|
||||
import { ChatStorageService } from './chat-storage.service';
|
||||
import { ChatMethodsService } from './chat-methods.service';
|
||||
import { AESEncrypt } from '../aesencrypt.service'
|
||||
@@ -41,7 +40,7 @@ export class WsChatMethodsService {
|
||||
users: chatUser[] = []
|
||||
sessionStore = SessionStore
|
||||
|
||||
loggedUser: any;
|
||||
|
||||
|
||||
delete = []
|
||||
|
||||
@@ -56,7 +55,6 @@ export class WsChatMethodsService {
|
||||
private NfService: NfService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
private ChatStorageService: ChatStorageService,
|
||||
private ChatMethodsService:ChatMethodsService,
|
||||
private AESEncrypt: AESEncrypt,
|
||||
@@ -64,7 +62,7 @@ export class WsChatMethodsService {
|
||||
private NetworkServiceService: NetworkServiceService,
|
||||
) {
|
||||
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
|
||||
this.loadChat()
|
||||
|
||||
@@ -93,13 +91,6 @@ export class WsChatMethodsService {
|
||||
})
|
||||
|
||||
|
||||
// on change profile remove a rooms
|
||||
this.changeProfileService.registerCallback(() => {
|
||||
this.clearChat()
|
||||
this.ReLoadChat()
|
||||
this.storage.remove('Rooms');
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private loadChat() {
|
||||
@@ -173,8 +164,10 @@ export class WsChatMethodsService {
|
||||
async getAllRooms () {
|
||||
this.loadingWholeList = true
|
||||
const rooms = await this.WsChatService.getRooms();
|
||||
try {
|
||||
await this.storage.remove('Rooms');
|
||||
} catch(e) {}
|
||||
|
||||
await this.storage.remove('Rooms');
|
||||
|
||||
await rooms.result.update.forEach( async (roomData: room, index) => {
|
||||
const roomId = this.getRoomId(roomData);
|
||||
|
||||
@@ -78,7 +78,6 @@ export class WsChatService {
|
||||
//
|
||||
if(message.result) {
|
||||
if(message.result.token) {
|
||||
|
||||
this.isLogin = true
|
||||
this.loginResponse = message
|
||||
|
||||
@@ -106,6 +105,7 @@ export class WsChatService {
|
||||
|
||||
getRooms(roomOlder = 1480377601) {
|
||||
|
||||
|
||||
//const requestId = uuidv4()
|
||||
const requestId = uuidv4()
|
||||
const message = {
|
||||
@@ -121,7 +121,6 @@ export class WsChatService {
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
||||
if(message.id == requestId) { // same request send
|
||||
resolve(message)
|
||||
//
|
||||
return true
|
||||
}
|
||||
}})
|
||||
@@ -186,6 +185,7 @@ export class WsChatService {
|
||||
logout() {
|
||||
this.isLogin = false
|
||||
this.ws.connected = false
|
||||
this.ws.disconnect()
|
||||
}
|
||||
|
||||
// send message to room
|
||||
@@ -749,6 +749,7 @@ export class WsChatService {
|
||||
const data = JSON.parse(event.data)
|
||||
|
||||
//
|
||||
// console.log(data)
|
||||
|
||||
for (const [key, value] of Object.entries(this.wsCallbacks)) {
|
||||
if(value.type== 'Onmessage') {
|
||||
@@ -777,6 +778,15 @@ export class WsChatService {
|
||||
|
||||
onerror: (event: any) => {
|
||||
|
||||
},
|
||||
disconnect:() => {
|
||||
if(this.socket) {
|
||||
this.socket.onopen = (event: any) => {}
|
||||
this.socket.onmessage = (event: any) => {}
|
||||
this.socket.onclose = (event: any) => {}
|
||||
this.socket.onerror = (event: any) => {}
|
||||
this.socket.close()
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user