2024-01-16 03:49:09 +08:00
|
|
|
import { PAD_SESSION_SUBSCRIPTION, PadSessionSubscriptionResponse } from './queries';
|
|
|
|
import Service from './service';
|
2024-06-04 21:40:54 +08:00
|
|
|
import useDeduplicatedSubscription from '/imports/ui/core/hooks/useDeduplicatedSubscription';
|
2024-01-16 03:49:09 +08:00
|
|
|
|
|
|
|
const PadSessionContainerGraphql = () => {
|
2024-06-04 21:40:54 +08:00
|
|
|
const { data: padSessionData } = useDeduplicatedSubscription<PadSessionSubscriptionResponse>(
|
|
|
|
PAD_SESSION_SUBSCRIPTION,
|
|
|
|
);
|
2024-01-16 03:49:09 +08:00
|
|
|
|
|
|
|
if (padSessionData) {
|
|
|
|
const sessions = new Set<string>();
|
|
|
|
padSessionData.sharedNotes_session.forEach((session) => sessions.add(session.sessionId));
|
|
|
|
Service.setCookie(Array.from(sessions));
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default PadSessionContainerGraphql;
|