@storyblok/nuxt 7.0.3-rc.0 → 7.1.1
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.
package/README.md
CHANGED
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
|
-
<a href="https://
|
|
20
|
-
<img src="https://img.shields.io/discord/700316478792138842?label=Join%20Our%20Discord%20Community&style=appveyor&logo=discord&color=
|
|
19
|
+
<a href="https://storyblok.com/join-discord">
|
|
20
|
+
<img src="https://img.shields.io/discord/700316478792138842?label=Join%20Our%20Discord%20Community&style=appveyor&logo=discord&color=8d60ff">
|
|
21
21
|
</a>
|
|
22
22
|
<a href="https://twitter.com/intent/follow?screen_name=storyblok">
|
|
23
|
-
<img src="https://img.shields.io/badge/Follow-%40storyblok-
|
|
23
|
+
<img src="https://img.shields.io/badge/Follow-%40storyblok-8d60ff?style=appveyor&logo=twitter" alt="Follow @Storyblok" />
|
|
24
24
|
</a><br />
|
|
25
25
|
<a href="https://app.storyblok.com/#!/signup?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt">
|
|
26
|
-
<img src="https://img.shields.io/badge/Try%20Storyblok-Free-
|
|
26
|
+
<img src="https://img.shields.io/badge/Try%20Storyblok-Free-8d60ff?style=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAHqADAAQAAAABAAAAHgAAAADpiRU/AAACRElEQVRIDWNgGGmAEd3D3Js3LPrP8D8WXZwSPiMjw6qvPoHhyGYwIXNAbGpbCjbzP0MYuj0YFqMroBV/wCxmIeSju64eDNzMBJUxvP/9i2Hnq5cM1devMnz984eQsQwETeRhYWHgIcJiXqC6VHlFBjUeXgav40cIWkz1oLYXFmGwFBImaDFBHyObcOzdW4aSq5eRhRiE2dgYlpuYoYSKJi8vw3GgWnyAJIs/AuPu4scPGObd/fqVQZ+PHy7+6udPOBsXgySLDfn5GRYYmaKYJcXBgWLpsx8/GPa8foWiBhuHJIsl2DkYQqWksZkDFgP5PObcKYYff//iVAOTIDlx/QPqRMb/YSYBaWlOToZIaVkGZmAZSQiQ5OPtwHwacuo4iplMQEu6tXUZMhSUGDiYmBjylFQYvv/7x9B04xqKOnQOyT5GN+Df//8M59ASXKyMHLoyDD5JPtbj42OYrm+EYgg70JfuYuIoYmLs7AwMjIzA+uY/zjAnyWJpDk6GOFnCvrn86SOwmsNtKciVFAc1ileBHFDC67lzG10Yg0+SjzF0ownsf/OaofvOLYaDQJoQIGix94ljv1gIZI8Pv38zPvj2lQWYf3HGKbpDCFp85v07NnRN1OBTPY6JdRSGxcCw2k6sZuLVMZ5AV4s1TozPnGGFKbz+/PE7IJsHmC//MDMyhXBw8e6FyRFLv3Z0/IKuFqvFyIqAzd1PwBzJw8jAGPfVx38JshwlbIygxmYY43/GQmpais0ODDHuzevLMARHBcgIAQAbOJHZW0/EyQAAAABJRU5ErkJggg==" alt="Follow @Storyblok" />
|
|
27
27
|
</a>
|
|
28
28
|
</p>
|
|
29
29
|
|
|
@@ -440,7 +440,7 @@ Use this one-line function to cover the most common use case: updating the story
|
|
|
440
440
|
## Support
|
|
441
441
|
|
|
442
442
|
- Bugs or Feature Requests? [Submit an issue](/../../issues/new);
|
|
443
|
-
- Do you have questions about Storyblok or you need help? [Join our Discord Community](https://
|
|
443
|
+
- Do you have questions about Storyblok or you need help? [Join our Discord Community](https://storyblok.com/join-discord).
|
|
444
444
|
|
|
445
445
|
## Contributing
|
|
446
446
|
|
package/dist/module.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ISbStoriesParams, ISbStoryData, StoryblokBridgeConfigV2 } from '@storyblok/vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
interface StoryblokAsyncResult<T = ISbStoryData> {
|
|
3
|
+
value: T;
|
|
4
|
+
status?: number;
|
|
5
|
+
response?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const useAsyncStoryblok: (url: string, apiOptions?: ISbStoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => Promise<StoryblokAsyncResult>;
|
|
8
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useStoryblokApi, useStoryblokBridge } from "@storyblok/vue";
|
|
2
|
-
import { onMounted, useAsyncData, useState } from "#imports";
|
|
2
|
+
import { onMounted, reactive, useAsyncData, useState } from "#imports";
|
|
3
3
|
export const useAsyncStoryblok = async (url, apiOptions = {}, bridgeOptions = {}) => {
|
|
4
4
|
const storyblokApiInstance = useStoryblokApi();
|
|
5
5
|
const uniqueKey = `${JSON.stringify(apiOptions)}${url}`;
|
|
6
6
|
const story = useState(`${uniqueKey}-state`);
|
|
7
|
+
const error = useState(`${uniqueKey}-error`);
|
|
7
8
|
onMounted(() => {
|
|
8
9
|
if (story.value && story.value.id) {
|
|
9
10
|
useStoryblokBridge(
|
|
@@ -14,15 +15,43 @@ export const useAsyncStoryblok = async (url, apiOptions = {}, bridgeOptions = {}
|
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
17
|
if (!story.value) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
try {
|
|
19
|
+
const { data } = await useAsyncData(uniqueKey, () => {
|
|
20
|
+
return storyblokApiInstance.get(
|
|
21
|
+
`cdn/stories/${url}`,
|
|
22
|
+
apiOptions
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
if (data) {
|
|
26
|
+
story.value = data.value?.data.story;
|
|
27
|
+
error.value = null;
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (typeof err === "object" && err !== null && "status" in err && "response" in err) {
|
|
31
|
+
error.value = {
|
|
32
|
+
status: err.status || err.response?.status,
|
|
33
|
+
response: err.message || err.response?.statusText
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
error.value = {
|
|
37
|
+
status: void 0,
|
|
38
|
+
response: "An unknown error occurred"
|
|
39
|
+
};
|
|
40
|
+
}
|
|
25
41
|
}
|
|
26
42
|
}
|
|
27
|
-
return
|
|
43
|
+
return reactive({
|
|
44
|
+
get value() {
|
|
45
|
+
return story.value;
|
|
46
|
+
},
|
|
47
|
+
set value(newValue) {
|
|
48
|
+
story.value = newValue;
|
|
49
|
+
},
|
|
50
|
+
get status() {
|
|
51
|
+
return error.value?.status;
|
|
52
|
+
},
|
|
53
|
+
get response() {
|
|
54
|
+
return error.value?.response;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
28
57
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.1.1",
|
|
5
5
|
"description": "Storyblok Nuxt module",
|
|
6
|
+
"homepage": "https://github.com/storyblok/monoblok/tree/main/packages/nuxt#readme",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
|
-
"url": "
|
|
9
|
+
"url": "https://github.com/storyblok/monoblok.git",
|
|
10
|
+
"directory": "packages/nuxt"
|
|
9
11
|
},
|
|
10
12
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/storyblok/
|
|
13
|
+
"url": "https://github.com/storyblok/monoblok/issues"
|
|
12
14
|
},
|
|
13
15
|
"exports": {
|
|
14
16
|
".": {
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
"dist"
|
|
24
26
|
],
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"@storyblok/vue": "9.
|
|
28
|
+
"@storyblok/vue": "9.1.1"
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"@cypress/vite-dev-server": "^6.0.3",
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
"@nuxt/test-utils": "^3.15.4",
|
|
36
38
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
37
39
|
"@storyblok/eslint-config": "^0.3.0",
|
|
38
|
-
"@types/node": "^22.15.
|
|
40
|
+
"@types/node": "^22.15.18",
|
|
39
41
|
"cypress": "^14.3.3",
|
|
40
42
|
"eslint": "^9.26.0",
|
|
41
43
|
"eslint-config-prettier": "^10.0.1",
|