mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
add vuex store with 'connected' state
This commit is contained in:
parent
665b661a2b
commit
6fb98f2195
4 changed files with 32 additions and 3 deletions
5
app/package-lock.json
generated
5
app/package-lock.json
generated
|
@ -10934,6 +10934,11 @@
|
||||||
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"vuex": {
|
||||||
|
"version": "3.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.5.1.tgz",
|
||||||
|
"integrity": "sha512-w7oJzmHQs0FM9LXodfskhw9wgKBiaB+totOdb8sNzbTB2KDCEEwEs29NzBZFh/lmEK1t5tDmM1vtsO7ubG1DFw=="
|
||||||
|
},
|
||||||
"watchpack": {
|
"watchpack": {
|
||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz",
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
"fork-awesome": "^1.1.7",
|
"fork-awesome": "^1.1.7",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-i18n": "^8.17.3",
|
"vue-i18n": "^8.17.3",
|
||||||
"vue-router": "^3.2.0"
|
"vue-router": "^3.2.0",
|
||||||
|
"vuex": "^3.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "~4.4.0",
|
"@vue/cli-plugin-babel": "~4.4.0",
|
||||||
"@vue/cli-plugin-eslint": "~4.4.0",
|
"@vue/cli-plugin-eslint": "~4.4.0",
|
||||||
"@vue/cli-plugin-router": "^4.4.6",
|
"@vue/cli-plugin-router": "^4.4.6",
|
||||||
|
"@vue/cli-plugin-vuex": "^4.4.6",
|
||||||
"@vue/cli-service": "~4.4.0",
|
"@vue/cli-service": "~4.4.0",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"bootstrap": "^4.3.1",
|
"bootstrap": "^4.3.1",
|
||||||
|
|
|
@ -3,6 +3,7 @@ import App from './App.vue'
|
||||||
import './plugins/bootstrap-vue'
|
import './plugins/bootstrap-vue'
|
||||||
import i18n from './plugins/i18n'
|
import i18n from './plugins/i18n'
|
||||||
import router from './plugins/router'
|
import router from './plugins/router'
|
||||||
|
import store from './plugins/store'
|
||||||
|
|
||||||
import * as globalsComponents from './components/globals'
|
import * as globalsComponents from './components/globals'
|
||||||
|
|
||||||
|
@ -11,12 +12,12 @@ Vue.config.productionTip = false
|
||||||
|
|
||||||
// Register global components
|
// Register global components
|
||||||
for (let component of Object.values(globalsComponents)) {
|
for (let component of Object.values(globalsComponents)) {
|
||||||
Vue.component(component.name, component)
|
Vue.component(component.name, component)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
i18n,
|
i18n,
|
||||||
router,
|
router,
|
||||||
|
store,
|
||||||
render: h => h(App),
|
render: h => h(App),
|
||||||
}).$mount('#app')
|
}).$mount('#app')
|
||||||
|
|
21
app/src/plugins/store.js
Normal file
21
app/src/plugins/store.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
|
|
||||||
|
Vue.use(Vuex)
|
||||||
|
|
||||||
|
export default new Vuex.Store({
|
||||||
|
state: {
|
||||||
|
connected: localStorage.getItem('connected') === 'true'
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
['CONNECTED'] (state, connected) {
|
||||||
|
localStorage.setItem('connected', connected)
|
||||||
|
state.connected = connected
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
},
|
||||||
|
modules: {
|
||||||
|
}
|
||||||
|
})
|
Loading…
Add table
Reference in a new issue