introduce vuex
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2021-09-19 17:30:37 +02:00
parent 94d2a98b96
commit a408cae686
10 changed files with 129 additions and 46 deletions

View File

@ -3,6 +3,9 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import { createRouter, createWebHistory } from 'vue-router'
import store from '@/store'
import Index from '@/views/Index.vue'
import Search from '@/views/Search.vue'
import Edit from '@/views/profile/Edit.vue'
@ -16,9 +19,9 @@ const routes = [
template: "<router-view/>",
},
beforeEnter: (to, from, next) => {
if(localStorage.getItem('token') !== null){
if (store.state.token){
next()
}else{
} else {
next({path: '/', query: {url: to.fullPath, access: false}})
}
},
@ -52,4 +55,4 @@ const router = createRouter({
routes
})
export default router
export default router