refactor: ⚡ move autoload to init in the right vue
This commit is contained in:
parent
891d4762d0
commit
cf6bd440bf
|
@ -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']),
|
||||||
},
|
},
|
||||||
|
|
|
@ -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 {}
|
|
||||||
|
|
Loading…
Reference in New Issue