From 96e3f8e82651f2d706c9246fdda9f02836873596 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Tue, 21 Jun 2022 00:42:29 +0000 Subject: [PATCH] feat(#77): add vuex-persistedstate --- nuxt/nuxt.config.js | 5 ++++- nuxt/package.json | 3 ++- nuxt/plugins/{gtag.js => gtag.client.js} | 0 nuxt/plugins/vuex-persistedstate.client.js | 5 +++++ nuxt/yarn.lock | 13 +++++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) rename nuxt/plugins/{gtag.js => gtag.client.js} (100%) create mode 100644 nuxt/plugins/vuex-persistedstate.client.js diff --git a/nuxt/nuxt.config.js b/nuxt/nuxt.config.js index 8456ca6..0f79b46 100644 --- a/nuxt/nuxt.config.js +++ b/nuxt/nuxt.config.js @@ -24,7 +24,10 @@ export default { css: [], // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins - plugins: [{ src: '~/plugins/gtag.js', mode: 'client' }], + plugins: [ + { src: '~/plugins/gtag.client.js' }, + { src: '~/plugins/vuex-persistedstate.client.js' }, + ], // Auto import components: https://go.nuxtjs.dev/config-components components: true, diff --git a/nuxt/package.json b/nuxt/package.json index e731457..e48d266 100644 --- a/nuxt/package.json +++ b/nuxt/package.json @@ -40,7 +40,8 @@ "ellipsize": "^0.5.1", "nuxt": "2.15.8", "vue-gravatar": "^1.4.1", - "vue-gtag": "^1" + "vue-gtag": "^1", + "vuex-persistedstate": "^4.1.0" }, "devDependencies": { "@babel/eslint-parser": "^7.18.2", diff --git a/nuxt/plugins/gtag.js b/nuxt/plugins/gtag.client.js similarity index 100% rename from nuxt/plugins/gtag.js rename to nuxt/plugins/gtag.client.js diff --git a/nuxt/plugins/vuex-persistedstate.client.js b/nuxt/plugins/vuex-persistedstate.client.js new file mode 100644 index 0000000..d973926 --- /dev/null +++ b/nuxt/plugins/vuex-persistedstate.client.js @@ -0,0 +1,5 @@ +import createPersistedState from 'vuex-persistedstate' + +export default ({ store }) => { + createPersistedState({ key: 'druxtCache' })(store) +} diff --git a/nuxt/yarn.lock b/nuxt/yarn.lock index d1c0d05..9efd453 100644 --- a/nuxt/yarn.lock +++ b/nuxt/yarn.lock @@ -18223,6 +18223,11 @@ shell-quote@^1.4.2, shell-quote@^1.6.1: resolved "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz" integrity sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw== +shvl@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/shvl/-/shvl-2.0.3.tgz#eb4bd37644f5684bba1fc52c3010c96fb5e6afd1" + integrity sha512-V7C6S9Hlol6SzOJPnQ7qzOVEWUQImt3BNmmzh40wObhla3XOYMe4gGiYzLrJd5TFa+cI2f9LKIRJTTKZSTbWgw== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" @@ -20474,6 +20479,14 @@ vue@^2.6.12, vue@^2.6.14: resolved "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz" integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ== +vuex-persistedstate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-4.1.0.tgz#127165f85f5b4534fb3170a5d3a8be9811bd2a53" + integrity sha512-3SkEj4NqwM69ikJdFVw6gObeB0NHyspRYMYkR/EbhR0hbvAKyR5gksVhtAfY1UYuWUOCCA0QNGwv9pOwdj+XUQ== + dependencies: + deepmerge "^4.2.2" + shvl "^2.0.3" + vuex@^3.6.2: version "3.6.2" resolved "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz"