浏览代码

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

正在加载...
取消
保存