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/providers/SessionProvider.tsx

17 lines
599 B

import { SessionContext } from '@rocket.chat/ui-contexts';
import { Session } from 'meteor/session';
import type { FC } from 'react';
import React from 'react';
import { createReactiveSubscriptionFactory } from '../lib/createReactiveSubscriptionFactory';
const contextValue = {
query: createReactiveSubscriptionFactory<unknown>((name) => Session.get(name)),
dispatch: (name: string, value: unknown): void => {
Session.set(name, value);
},
};
const SessionProvider: FC = ({ children }) => <SessionContext.Provider children={children} value={contextValue} />;
export default SessionProvider;