This is my route.js
import ProfilePage from '../pages/profile.vue';
function checkAuth({ to, from, resolve, reject }) {
if (this.$root.userCheck) {
resolve();
} else {
reject();
}
}
var routes = [
{
path: '/profile',
component: ProfilePage,
beforeEnter : checkAuth,
},
]