Chat moved up to top level now in all services frontend
This commit is contained in:
parent
814c389e38
commit
b4af6e08ca
32 changed files with 687 additions and 42 deletions
29
frontend/src/chat/chatHelperFunctions/quitChat.ts
Normal file
29
frontend/src/chat/chatHelperFunctions/quitChat.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Socket } from "socket.io-client";
|
||||
import { getSocket } from "../chat";
|
||||
import { logout } from "./logout";
|
||||
import { connected } from "./connected";
|
||||
import { showError } from "@app/toast";
|
||||
import { setTitle } from "@app/routing";
|
||||
|
||||
/**
|
||||
* function to quit the chat - leaves the ping-Buddies list
|
||||
* @param socket
|
||||
*/
|
||||
|
||||
export function quitChat (socket: Socket) {
|
||||
|
||||
try {
|
||||
const systemWindow = document.getElementById('system-box') as HTMLDivElement;
|
||||
const chatWindow = document.getElementById("t-chatbox") as HTMLDivElement;
|
||||
if (socket) {
|
||||
logout(socket);
|
||||
setTitle('Chat Page');
|
||||
connected(socket);
|
||||
} else {
|
||||
getSocket();
|
||||
}
|
||||
} catch (e) {
|
||||
showError('Failed to Quit Chat: Unknown error');
|
||||
}
|
||||
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue