chore: create `LoggedInArea` (#35741)
Co-authored-by: Guilherme Gazzo <guilherme@gazzo.xyz>pull/35730/head
parent
895ea3fdbb
commit
eabc50d3b1
@ -0,0 +1,30 @@ |
||||
import { useUser } from '@rocket.chat/ui-contexts'; |
||||
import type { ReactNode } from 'react'; |
||||
|
||||
import { useNotificationUserCalendar } from '../../../hooks/notification/useNotificationUserCalendar'; |
||||
import { useNotifyUser } from '../../../hooks/notification/useNotifyUser'; |
||||
import { useForceLogout } from '../hooks/useForceLogout'; |
||||
import { useOTRMessaging } from '../hooks/useOTRMessaging'; |
||||
import { useStoreCookiesOnLogin } from '../hooks/useStoreCookiesOnLogin'; |
||||
import { useUpdateVideoConfUser } from '../hooks/useUpdateVideoConfUser'; |
||||
import { useWebRTC } from '../hooks/useWebRTC'; |
||||
|
||||
const LoggedInArea = ({ children }: { children: ReactNode }) => { |
||||
const user = useUser(); |
||||
|
||||
if (!user) { |
||||
throw new Error('User not logged'); |
||||
} |
||||
|
||||
useNotifyUser(user); |
||||
useUpdateVideoConfUser(user._id); |
||||
useWebRTC(user._id); |
||||
useOTRMessaging(user._id); |
||||
useNotificationUserCalendar(user); |
||||
useForceLogout(user._id); |
||||
useStoreCookiesOnLogin(user._id); |
||||
|
||||
return children; |
||||
}; |
||||
|
||||
export default LoggedInArea; |
||||
Loading…
Reference in new issue