SHARE
TWEET

Untitled

a guest Jun 16th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onPageLoad(sink => {
  2.   let isUserLoggedInServerCheck = false;
  3.   if (sink.request.cookies.sssr) {
  4.     isUserLoggedInServerCheck = true;
  5.   }
  6.  
  7.   sink.renderIntoElementById(
  8.     'react-target',
  9.     renderToString(
  10.       <AppServer
  11.         location={sink.request.url}
  12.         isUserLoggedInServerCheck={isUserLoggedInServerCheck}
  13.       />
  14.     )
  15.   );
  16. });
  17.      
  18. const AppServer = props => {
  19.   const context = {};
  20.   const { location, isUserLoggedInServerCheck } = props;
  21.  
  22.   return (
  23.     <StaticRouter context={context} location={location}>
  24.       <div className="application">
  25.         <Switch isUserLoggedInServerCheck={isUserLoggedInServerCheck}>
  26.           <Route path="/" exact component={CandidateLanding} />
  27.         </Switch>
  28.       </div>
  29.     </StaticRouter>
  30.   );
  31. };
  32.      
  33. function CandidateLanding(props) {
  34.   const { location, isUserLoggedInServerCheck } = props;
  35.  
  36.   return (
  37.     <div>
  38.       <Navbar location={location.path} isUserLoggedInServerCheck={isUserLoggedInServerCheck} />
  39.     </div>
  40.   );
  41. }
  42.  
  43. const CandidateLandingContainer = withTracker(props => {
  44.   const { isUserLoggedInServerCheck } = props;
  45.   if (Meteor.isServer) {
  46.     return {
  47.       isUserLoggedInServerCheck
  48.     };
  49.   }
  50.  
  51.   if (Meteor.isClient) {
  52.     return {
  53.       isUserLoggedInServerCheck
  54.     };
  55.   }
  56. })(CandidateLanding);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top