Skip to content

Commit

Permalink
src/boot: register Pinia Vue store JS lib (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi authored Sep 5, 2024
1 parent b989570 commit e2dd83b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = configure(function (ctx) {
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli-vite/boot-files
boot: ['logger', 'i18n', 'swiper', 'global_vars'],
boot: ['global_vars', 'i18n', 'logger', 'pinia', 'swiper'],

// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
css: ['app.scss'],
Expand Down
9 changes: 4 additions & 5 deletions src/stores/index.ts → src/boot/pinia.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { store } from 'quasar/wrappers';
import { boot } from 'quasar/wrappers';

import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';

Expand All @@ -16,11 +17,9 @@ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
* @see https://prazdevs.github.io/pinia-plugin-persistedstate/guide/limitations.html
*/

export default store(() => {
export default boot(({ app }) => {
const pinia = createPinia();

// plugins
pinia.use(piniaPluginPersistedstate);

return pinia;
app.use(pinia);
});

0 comments on commit e2dd83b

Please sign in to comment.