This my route code, I want to redirect the user to login page if he is not logged in
Meteor.startup(() => {
function requireAuth(nextState, replace) {
if (!Meteor1) {
replace({
pathname: '/login',
state: { nextPathname: nextState.location.pathname }
})
}
}
function requireNotAuthed(nextState, replace) {
if (Meteor1) {
replace({
pathname: '/',
})
}
}
render(
<Router history = {browserHistory}>
<Route path="/" component={ Navigation } onChange={requireAuth}>
<IndexRoute component={ App } onEnter={requireAuth} />
<Route path="/one" component={ One } onEnter={requireAuth} />
<Route path="/two" component={ Two } onEnter={requireAuth} />
<Route path="/login" component={Login} onEnter={requireNotAuthed}/>
<Route path="*" component={ Not } onEnter={requireAuth} />
</Route>
</Router>,
document.getElementById('app'));
});
export default createContainer(() => {
return {
Meteor1: Meteor.user()
};
}, Meteor.startup);
But in the console, it throws me this error
Uncaught ReferenceError: Meteor1 is not defined
I’m missing something on my code ?? Should I add account-base package also??