ft_transcendence/frontend/src/pages/chat/getProfil.ts
Nigel 85eca5d301
Nigel/block user (#60)
* WIP block users

* Add test to check if the person for user X is blocked or not

* Added function isBlocked return true if user x is blocked by user y

* Added block ans un block messages

* Route / broadcast added ny Maix

* notification block and un block with icon now works, started clean up

* cleaning up the code

* cleaning up the code - WIP

* cleaning up the code - WIP

* clean up code - WIP

* clean up code - WIP

* WIP block users

* Add test to check if the person for user X is blocked or not

* Added function isBlocked return true if user x is blocked by user y

* Added block ans un block messages

* REBASE -trying

* REBASE trying

* REBASE problems

* REBASE problems

* REBASE problems

* MERGE problems

* REBASE problem

* REBASE problem

* clean up code - WIP

* MERGED master into nigel/blockUser

* linter OK

* TTT problem with package

* Deletes tic tac and icons
2025-12-16 15:21:07 +01:00

24 lines
532 B
TypeScript

import { Socket } from 'socket.io-client';
/**
* getProfil of a user
* @param socket
* @param user
* @returns
*/
export function getProfil(socket: Socket, user: string) {
if (!socket.connected) return;
const profil = {
command: '@profil',
destination: 'profilMessage',
type: "chat",
user: user,
token: document.cookie ?? "",
text: user,
timestamp: Date.now(),
SenderWindowID: socket.id,
};
// addMessage(JSON.stringify(profil));
socket.emit('profilMessage', JSON.stringify(profil));
}