@vueuse/nuxt 7.4.1 → 7.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/ssr-plugin.mjs +9 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/nuxt",
3
- "version": "7.4.1",
3
+ "version": "7.4.2",
4
4
  "description": "VueUse Nuxt Module",
5
5
  "keywords": [
6
6
  "vue",
@@ -34,7 +34,7 @@
34
34
  "module": "./index.mjs",
35
35
  "types": "./index.d.ts",
36
36
  "dependencies": {
37
- "@vueuse/core": "7.4.1",
37
+ "@vueuse/core": "7.4.2",
38
38
  "local-pkg": "^0.4.0",
39
39
  "vue-demi": "*"
40
40
  }
package/ssr-plugin.mjs CHANGED
@@ -4,22 +4,15 @@ import { useCookie } from '#app'
4
4
 
5
5
  setSSRHandler('getDefaultStorage', () => {
6
6
  const cookieMap = new Map()
7
+ const get = (key) => {
8
+ if (!cookieMap.get(key))
9
+ cookieMap.set(key, useCookie(key, { maxAge: 2147483646 }))
10
+ return cookieMap.get(key)
11
+ }
7
12
  return {
8
- getItem: (key) => {
9
- if (!cookieMap.get(key))
10
- cookieMap.set(key, useCookie(key))
11
- return cookieMap.get(key).value
12
- },
13
- setItem: (key, value) => {
14
- if (!cookieMap.get(key))
15
- cookieMap.set(key, useCookie(key))
16
- cookieMap.get(key).value = value
17
- },
18
- removeItem: (key) => {
19
- if (!cookieMap.get(key))
20
- cookieMap.set(key, useCookie(key))
21
- cookieMap.get(key).value = undefined
22
- },
13
+ getItem: (key) => get(key).value,
14
+ setItem: (key, value) => get(key).value = value,
15
+ removeItem: (key) => get(key).value = undefined
23
16
  }
24
17
  })
25
18
 
@@ -45,4 +38,4 @@ if (process.server) {
45
38
  })
46
39
  }
47
40
 
48
- export default () => {}
41
+ export default () => { }