Skip to content

Commit

Permalink
Vue.js 2.0 リリース対応
Browse files Browse the repository at this point in the history
一部仕様変更に追従
  • Loading branch information
jkazama committed Oct 1, 2016
1 parent 148d979 commit c385837
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sample-ui-vue",
"version": "1.0.0",
"version": "1.0.1",
"description": "Vue.js / VueRouter Boilerplate",
"main": "src/js/app.js",
"scripts": {
Expand All @@ -17,8 +17,8 @@
"co": "^4.6.0",
"superagent": "^2.2.0",
"lodash": "^4.15.0",
"vue": "^2.0.0-rc.4",
"vue-router": "^2.0.0-rc.4",
"vue": "^2.0.0",
"vue-router": "^2.0.0",
"jquery": "^3.1.0",
"moment": "^2.14.0",
"bootstrap-sass": "^3.3.0",
Expand Down Expand Up @@ -57,7 +57,7 @@
"style-loader": "^0.13.0",
"template-html-loader": "^0.0.3",
"vue-hot-reload-api": "^2.0.0",
"vue-loader": "^9.4.0",
"vue-loader": "^9.5.0",
"webpack": "^1.13.0",
"webpack-stream": "^3.2.0"
}
Expand Down
7 changes: 4 additions & 3 deletions src/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ export default {
},
computed: {
user() {
return this.sessionValue()
let logined = this.sessionValue()
return logined ? logined : {}
}
},
methods: {
checkLogin(route, redirect, next) {
checkLogin(to, from, next) {
let success = (v) => {
this.logined = true
next()
Expand All @@ -54,7 +55,7 @@ export default {
Lib.Log.debug('ログイン情報を確認できませんでした')
let current = this.logined // 事前ログイン状態に応じて表示ページを変更
this.logoutLocal()
current ? redirect('/timeout') : redirect('/login')
current ? next('/timeout') : next('/login')
}
api.loginStatus(success, failure)
},
Expand Down
6 changes: 3 additions & 3 deletions src/js/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ var router = new Router({
})

// SPA ルーティング前のログインチェック差込
router.beforeEach((route, redirect, next) => {
if (route.matched.some(m => m.meta.anonymous)) {
router.beforeEach((to, from, next) => {
if (to.matched.some(m => m.meta.anonymous)) {
next()
} else {
Vue.nextTick(() => router.app.$refs.app.checkLogin(route, redirect, next))
Vue.nextTick(() => router.app.$refs.app.checkLogin(to, from, next))
}
})
export default router

0 comments on commit c385837

Please sign in to comment.