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