2022-05-26 06:38:40 +03:00
|
|
|
import { ConnectedClientInfoEvent } from '../../../interfaces/socket-events';
|
|
|
|
|
|
|
|
export default function handleConnectedClientInfoMessage(
|
|
|
|
message: ConnectedClientInfoEvent,
|
|
|
|
setChatDisplayName: (string) => void,
|
2022-06-25 07:30:54 +03:00
|
|
|
setChatUserId: (number) => void,
|
|
|
|
setIsChatModerator: (boolean) => void,
|
2022-05-26 06:38:40 +03:00
|
|
|
) {
|
|
|
|
const { user } = message;
|
2022-06-25 07:30:54 +03:00
|
|
|
const { id, displayName, scopes } = user;
|
2022-05-26 06:38:40 +03:00
|
|
|
setChatDisplayName(displayName);
|
2022-06-25 07:30:54 +03:00
|
|
|
setChatUserId(id);
|
2022-06-25 07:53:16 +03:00
|
|
|
setIsChatModerator(scopes?.includes('moderator'));
|
2022-05-26 06:38:40 +03:00
|
|
|
}
|