@functionalcms/svelte-components 5.5.4 → 5.5.6

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.
@@ -6,15 +6,20 @@ export const sessionStorageHandler = (url, token, contentName) => {
6
6
  token: token
7
7
  });
8
8
  return async ({ event, resolve }) => {
9
- const itemContent = await redis.get(contentName);
10
- if (itemContent != ''
11
- && (Array.isArray(itemContent) != [] && itemContent.length > 0)
12
- && itemContent != null) {
13
- event.locals[contentName] = itemContent;
9
+ const uniqueKey = `${event.locals.user.id}_${contentName}`;
10
+ if (event?.locals?.user) {
11
+ const itemContent = await redis.get(uniqueKey);
12
+ if (itemContent != ''
13
+ && (Array.isArray(itemContent) != [] && itemContent.length > 0)
14
+ && itemContent != null) {
15
+ event.locals[contentName] = itemContent;
16
+ }
14
17
  }
15
18
  const result = await resolve(event);
16
- if (event.locals[contentName]) {
17
- redis.set(contentName, JSON.stringify(event.locals[contentName]));
19
+ if (event?.locals?.user) {
20
+ if (event.locals[contentName]) {
21
+ redis.set(uniqueKey, JSON.stringify(event.locals[contentName]));
22
+ }
18
23
  }
19
24
  return result;
20
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "5.5.4",
3
+ "version": "5.5.6",
4
4
  "license": "MIT",
5
5
  "watch": {
6
6
  "build": {