15.07 Make the Settings Persistent using LocalStorage Plugin

This commit is contained in:
Fredrick W Warren 2021-02-12 07:35:03 -08:00
parent 92a7f0df0d
commit 7443c2cf6a
2 changed files with 11 additions and 3 deletions

View File

@ -100,7 +100,8 @@ module.exports = function (/* ctx */) {
// Quasar plugins // Quasar plugins
plugins: [ plugins: [
'Dialog' 'Dialog',
'LocalStorage'
] ]
}, },

View File

@ -1,3 +1,5 @@
import { LocalStorage } from 'quasar'
const state = { const state = {
settings: { settings: {
show12HourTimeFormat: false, show12HourTimeFormat: false,
@ -15,11 +17,16 @@ const mutations = {
} }
const actions = { const actions = {
setShow12HourTimeFormat ({ commit }, value) { setShow12HourTimeFormat ({ commit, dispatch }, value) {
commit('setShow12HourTimeFormat', value) commit('setShow12HourTimeFormat', value)
dispatch('saveSettings')
}, },
setShowTasksInOnelist ({ commit }, value) { setShowTasksInOnelist ({ commit, dispatch }, value) {
commit('setShowTasksInOnelist', value) commit('setShowTasksInOnelist', value)
dispatch('saveSettings')
},
saveSettings ({ state }) {
LocalStorage.set('settings', state.settings)
} }
} }