refactor: move autoload to init in the right vue
All checks were successful
repod / xml (push) Successful in 18s
repod / php (push) Successful in 1m9s
repod / nodejs (push) Successful in 1m15s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-08-15 19:10:19 +02:00
parent 891d4762d0
commit cf6bd440bf
2 changed files with 8 additions and 7 deletions

View File

@ -44,6 +44,7 @@ import { NcActionCheckbox, NcAppNavigationItem } from '@nextcloud/vue'
import { mapActions, mapState } from 'pinia' import { mapActions, mapState } from 'pinia'
import FilterIcon from 'vue-material-design-icons/Filter.vue' import FilterIcon from 'vue-material-design-icons/Filter.vue'
import FilterSettingsIcon from 'vue-material-design-icons/FilterSettings.vue' import FilterSettingsIcon from 'vue-material-design-icons/FilterSettings.vue'
import { getCookie } from '../../utils/cookies.js'
import { useSettings } from '../../store/settings.js' import { useSettings } from '../../store/settings.js'
export default { export default {
@ -64,6 +65,12 @@ export default {
) )
}, },
}, },
mounted() {
try {
const filters = getCookie('repod.filters')
this.filters = JSON.parse(filters)
} catch {}
},
methods: { methods: {
...mapActions(useSettings, ['setFilters']), ...mapActions(useSettings, ['setFilters']),
}, },

View File

@ -1,5 +1,5 @@
import { getCookie, setCookie } from '../utils/cookies.js'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { setCookie } from '../utils/cookies.js'
export const useSettings = defineStore('settings', { export const useSettings = defineStore('settings', {
state: () => ({ state: () => ({
@ -16,9 +16,3 @@ export const useSettings = defineStore('settings', {
}, },
}, },
}) })
try {
const settings = useSettings()
const filters = getCookie('repod.filters')
settings.filters = JSON.parse(filters)
} catch {}