You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
577 B
19 lines
577 B
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;
|
|
|