diff --git a/changelog.d/pinia.change b/changelog.d/pinia.change new file mode 100644 index 000000000..b44803a8d --- /dev/null +++ b/changelog.d/pinia.change @@ -0,0 +1 @@ +Partially migrated from vuex to pinia diff --git a/package.json b/package.json index 74b8d3c44..8cb74ce40 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "pako": "^2.1.0", "parse-link-header": "2.0.0", "phoenix": "1.7.19", + "pinia": "^2.0.33", "punycode.js": "2.3.1", "qrcode": "1.5.4", "querystring-es3": "0.2.1", diff --git a/src/App.js b/src/App.js index 3142d0629..ca218cfff 100644 --- a/src/App.js +++ b/src/App.js @@ -17,6 +17,8 @@ import GlobalNoticeList from './components/global_notice_list/global_notice_list import { windowWidth, windowHeight } from './services/window_utils/window_utils' import { mapGetters } from 'vuex' import { defineAsyncComponent } from 'vue' +import { useShoutStore } from './stores/shout' +import { useInterfaceStore } from './stores/interface' export default { name: 'app', @@ -60,7 +62,7 @@ export default { document.getElementById('modal').classList = ['-' + this.layoutType] }, mounted () { - if (this.$store.state.interface.themeApplied) { + if (useInterfaceStore().themeApplied) { this.removeSplash() } }, @@ -69,7 +71,7 @@ export default { }, computed: { themeApplied () { - return this.$store.state.interface.themeApplied + return useInterfaceStore().themeApplied }, layoutModalClass () { return '-' + this.layoutType @@ -106,7 +108,7 @@ export default { } } }, - shout () { return this.$store.state.shout.joined }, + shout () { return useShoutStore().joined }, suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled }, showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel && @@ -132,7 +134,7 @@ export default { hideShoutbox () { return this.$store.getters.mergedConfig.hideShoutbox }, - layoutType () { return this.$store.state.interface.layoutType }, + layoutType () { return useInterfaceStore().layoutType }, privateMode () { return this.$store.state.instance.private }, reverseLayout () { const { thirdColumnMode, sidebarRight: reverseSetting } = this.$store.getters.mergedConfig @@ -148,8 +150,8 @@ export default { }, methods: { updateMobileState () { - this.$store.dispatch('setLayoutWidth', windowWidth()) - this.$store.dispatch('setLayoutHeight', windowHeight()) + useInterfaceStore().setLayoutWidth(windowWidth()) + useInterfaceStore().setLayoutHeight(windowHeight()) }, removeSplash () { document.querySelector('#status').textContent = this.$t('splash.fun_' + Math.ceil(Math.random() * 4)) diff --git a/src/App.vue b/src/App.vue index 762e18515..34cc6b804 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@