@storyblok/nuxt 4.5.0 → 4.6.0
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,7 +6,8 @@ export const useAsyncStoryblok = async (
|
|
|
6
6
|
apiOptions = {},
|
|
7
7
|
bridgeOptions = {}
|
|
8
8
|
) => {
|
|
9
|
-
const
|
|
9
|
+
const uniqueKey = `${JSON.stringify(apiOptions)}${url}`;
|
|
10
|
+
const story = useState(`${uniqueKey}-state`, () => null);
|
|
10
11
|
const storyblokApiInstance = useStoryblokApi();
|
|
11
12
|
|
|
12
13
|
onMounted(() => {
|
|
@@ -20,7 +21,7 @@ export const useAsyncStoryblok = async (
|
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
const { data } = await useAsyncData(
|
|
23
|
-
|
|
24
|
+
`${uniqueKey}-asyncdata`,
|
|
24
25
|
async () => await storyblokApiInstance.get(`cdn/stories/${url}`, apiOptions)
|
|
25
26
|
);
|
|
26
27
|
story.value = data.value.data.story;
|
package/package.json
CHANGED
|
@@ -6,7 +6,8 @@ export const useAsyncStoryblok = async (
|
|
|
6
6
|
apiOptions = {},
|
|
7
7
|
bridgeOptions = {}
|
|
8
8
|
) => {
|
|
9
|
-
const
|
|
9
|
+
const uniqueKey = `${JSON.stringify(apiOptions)}${url}`;
|
|
10
|
+
const story = useState(`${uniqueKey}-state`, () => null);
|
|
10
11
|
const storyblokApiInstance = useStoryblokApi();
|
|
11
12
|
|
|
12
13
|
onMounted(() => {
|
|
@@ -20,7 +21,7 @@ export const useAsyncStoryblok = async (
|
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
const { data } = await useAsyncData(
|
|
23
|
-
|
|
24
|
+
`${uniqueKey}-asyncdata`,
|
|
24
25
|
async () => await storyblokApiInstance.get(`cdn/stories/${url}`, apiOptions)
|
|
25
26
|
);
|
|
26
27
|
story.value = data.value.data.story;
|