mirror of
https://github.com/owncast/owncast.git
synced 2024-12-21 00:35:47 +03:00
19 lines
577 B
TypeScript
19 lines
577 B
TypeScript
import { ConnectedClientInfoEvent } from '../../../interfaces/socket-events';
|
|
|
|
export function handleConnectedClientInfoMessage(
|
|
message: ConnectedClientInfoEvent,
|
|
setChatAuthenticated: (boolean) => void,
|
|
setCurrentUser: (CurrentUser) => void,
|
|
) {
|
|
const { user } = message;
|
|
const { id, displayName, displayColor, scopes, authenticated } = user;
|
|
setChatAuthenticated(authenticated);
|
|
|
|
setCurrentUser({
|
|
id: id.toString(),
|
|
displayName,
|
|
displayColor,
|
|
isModerator: scopes?.includes('MODERATOR'),
|
|
});
|
|
}
|
|
export default handleConnectedClientInfoMessage;
|