Sfoglia il codice sorgente

redirect to app if user authenticated

pull/342/head
Guillaume Vincent 8 anni fa
parent
commit
6ee0784391
1 ha cambiato i file con 14 aggiunte e 15 eliminazioni
  1. +14
    -15
      src/router.js

+ 14
- 15
src/router.js Vedi File

@@ -35,22 +35,21 @@ router.redirect({
});

router.beforeEach(transition => {
if (transition.to.auth_required) {
http.auth.checkAuth()
.then(() => {
if (transition.to.path === '/') {
transition.redirect('/app/');
} else {
transition.next();
}
})
.catch(() => {
http.auth.checkAuth()
.then(() => {
if (transition.to.path === '/') {
transition.redirect('/app/');
} else {
transition.next();
}
})
.catch(() => {
if (transition.to.auth_required) {
transition.redirect('/login/');
});
} else {
transition.next();
}
} else {
transition.next();
}
});
});


router.start(App, '#app');

Caricamento…
Annulla
Salva