I use meteor, react and redux.
I used redux to perform authentication in react.
And in my reducer, I checked the user’s login status with the Meteor.loggingIn() method.
With this code:
const INITIAL_STATE = Meteor.loggingIn();
So far, everything is in order and I know the user’s situation well and act accordingly.
But I also added SSR to my project and gave my Router file to the onPageLoad method to implement ssr for me.
And SSR works well too , but the server side cannot recognize the Meteor.loggingIn() method.
And in fact I used the same method to detect the user’s login status in the My Reducer.
And now the problem is that I can not find a method to detect that the user is logged in that responds to both the server side and the client side. So that there is no problem in ssr.
In the meantime, we need to render something in ssr that matches the user’s login status. So we can not be satisfied with the Meteor.loggingIn() method.