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
|
|
@ -1,32 +0,0 @@
|
|||
import { Socket } from "socket.io-client";
|
||||
import { isLoggedIn } from "./isLoggedIn";
|
||||
import { showError } from "@app/toast";
|
||||
import { updateUser } from "@app/auth";
|
||||
|
||||
/**
|
||||
* function displays who is logged in the chat in the ping-Bubbies window
|
||||
* @param socket
|
||||
*/
|
||||
|
||||
export async function connected(socket: Socket): Promise<void> {
|
||||
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const buddies = document.getElementById('div-buddies') as HTMLDivElement;
|
||||
const loggedIn = isLoggedIn();
|
||||
if (!loggedIn) throw('Not Logged in');
|
||||
let oldUser = localStorage.getItem("oldName") ?? "";
|
||||
if (loggedIn?.name === undefined) {return ;};
|
||||
oldUser = loggedIn.name ?? "";
|
||||
let user = await updateUser();
|
||||
localStorage.setItem("oldName", oldUser);
|
||||
buddies.textContent = "";
|
||||
socket.emit('list', {
|
||||
oldUser: oldUser,
|
||||
user: user?.name,
|
||||
});
|
||||
} catch (e) {
|
||||
showError('Failed to login: Unknown error');
|
||||
}
|
||||
}, 16);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue