refactor: move autoload to init in the right vue

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

View File

@ -1,5 +1,5 @@
import { getCookie, setCookie } from '../utils/cookies.js'
import { defineStore } from 'pinia'
import { setCookie } from '../utils/cookies.js'
export const useSettings = defineStore('settings', {
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 {}