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

16 lines
571 B

import { Session } from 'meteor/session';
import React, { FC } from 'react';
import { SessionContext } from '../contexts/SessionContext';
import { createReactiveSubscriptionFactory } from './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;