The communications platform that puts data protection first.
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.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/lib/user.ts

17 lines
475 B

import type { IUser } from '@rocket.chat/core-typings';
import { create } from 'zustand';
import { Users } from '../stores';
/**
* @private do not consume this store directly -- consume it via UserContext
*/
export const userIdStore = create<IUser['_id'] | undefined>(() => undefined);
export const getUserId = () => userIdStore.getState();
export const getUser = () => {
const userId = getUserId();
if (!userId) return undefined;
return Users.state.get(userId);
};