瀏覽代碼

redirect to app if user authenticated

pull/342/head
Guillaume Vincent 8 年之前
父節點
當前提交
6ee0784391
共有 1 個文件被更改,包括 14 次插入15 次删除
  1. +14
    -15
      src/router.js

+ 14
- 15
src/router.js 查看文件

@@ -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');

Loading…
取消
儲存