Open thearabbit opened 6 years ago
@thearabbit Haven't tested it but you could do something like this:
import VueProgressBar from 'vue-progressbar'
Vue.use(VueProgressBar )
Meteor.startup(() => {
// Start the vue app
const app = new Vue({
store,
...AppLayout,
}).$mount('app')
// Before each
app.$router.beforeEach((to, from, next) => {
app.$Progress.start()
if (!to.meta.notRequiresAuth) {
// Check user
if (!Meteor.loggingIn() && !Meteor.userId()) {
next({ path: '/login' })
} else {
next()
}
} else {
next()
}
})
// // After each
app.$router.afterEach((to, from) => {
app.$Progress.finish()
})
})
Thank for your reply, I will try soon
It work for Progressbar
, but don't work my Authentication
Have any solve?
Waiting...
Is your authentication a route change within Vue, or do you only initialize Vue itself after the user has logged in?
I base on
Meteor
. I checkProgressbar on Meteor Startup
Bc I use check
router hook
inApp Layout
don't work