2021-10-16 03:07:13 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import Pad from './component';
|
|
|
|
import Service from './service';
|
|
|
|
import SessionsService from './sessions/service';
|
2024-01-16 03:49:09 +08:00
|
|
|
import PadContainerGraphql from './pads-graphql/component';
|
2021-10-16 03:07:13 +08:00
|
|
|
|
|
|
|
const Container = ({ ...props }) => <Pad {...props} />;
|
|
|
|
|
2024-01-16 03:49:09 +08:00
|
|
|
withTracker((props) => {
|
2021-10-16 03:07:13 +08:00
|
|
|
const {
|
|
|
|
externalId,
|
|
|
|
hasPermission,
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
const hasPad = Service.hasPad(externalId);
|
|
|
|
const hasSession = SessionsService.hasSession(externalId);
|
|
|
|
|
|
|
|
if (hasPad && !hasSession && hasPermission) {
|
|
|
|
Service.createSession(externalId);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
hasSession,
|
|
|
|
};
|
|
|
|
})(Container);
|
2024-01-16 03:49:09 +08:00
|
|
|
|
|
|
|
export default PadContainerGraphql;
|