mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add vuex store
This commit is contained in:
parent
4d7d7b9bf0
commit
0aa5dc3507
@ -38,7 +38,8 @@
|
||||
"vue": "^2.6.11",
|
||||
"vue-apollo": "^3.0.8",
|
||||
"vue-jest": "^3.0.7",
|
||||
"vue-router": "^3.5.3"
|
||||
"vue-router": "^3.5.3",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.15.8",
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
import store from './store/store'
|
||||
|
||||
import router from './router/router'
|
||||
// import addNavigationGuards from './router/guards'
|
||||
import addNavigationGuards from './router/guards'
|
||||
|
||||
import { ApolloClient, ApolloLink, InMemoryCache, HttpLink } from 'apollo-boost'
|
||||
import VueApollo from 'vue-apollo'
|
||||
@ -45,10 +47,11 @@ const apolloProvider = new VueApollo({
|
||||
|
||||
Vue.use(BootstrapVue)
|
||||
|
||||
// addNavigationGuards(router, )
|
||||
addNavigationGuards(router, store)
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
apolloProvider,
|
||||
render: (h) => h(App),
|
||||
}).$mount('#app')
|
||||
|
||||
@ -3,8 +3,13 @@ import './main'
|
||||
import CONFIG from './config'
|
||||
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
jest.mock('vue')
|
||||
jest.mock('vuex')
|
||||
|
||||
const storeMock = jest.fn()
|
||||
Vuex.Store = storeMock
|
||||
|
||||
jest.mock('apollo-boost', () => {
|
||||
return {
|
||||
@ -38,4 +43,8 @@ describe('main', () => {
|
||||
it('calls Vue', () => {
|
||||
expect(Vue).toBeCalled()
|
||||
})
|
||||
|
||||
it.skip('creates a store', () => {
|
||||
expect(storeMock).toBeCalled()
|
||||
})
|
||||
})
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import routes from './routes'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const router = new VueRouter({
|
||||
base: '/admin',
|
||||
routes,
|
||||
|
||||
@ -7,10 +7,7 @@ const routes = [
|
||||
requiresAuth: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'not-found',
|
||||
component: NotFound,
|
||||
},
|
||||
{ path: '*', component: NotFound },
|
||||
]
|
||||
|
||||
export default routes
|
||||
|
||||
12
admin/src/store/store.js
Normal file
12
admin/src/store/store.js
Normal file
@ -0,0 +1,12 @@
|
||||
import Vuex from 'vuex'
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
token: 'some-valid-token',
|
||||
},
|
||||
})
|
||||
|
||||
export default store
|
||||
@ -12493,6 +12493,11 @@ vue@^2.6.11:
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
|
||||
integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==
|
||||
|
||||
vuex@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71"
|
||||
integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==
|
||||
|
||||
w3c-hr-time@^1.0.1, w3c-hr-time@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user