@b10cks/nuxt 0.10.3 → 0.10.4
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/dist/module.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Endpoint, type IBBaseQueryParams, type IBBlock, type IBContent, type IBContentQueryParams, type IBDataEntry, type IBDataSource, type IBResponse, type IBSpace } from '@b10cks/client';
|
|
2
2
|
export interface UseB10cksApiOptions<T> {
|
|
3
3
|
immediate?: boolean;
|
|
4
4
|
params?: Omit<IBBaseQueryParams, 'token'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useNuxtApp, useState } from "#app";
|
|
1
|
+
import { callOnce, useNuxtApp, useState } from "#app";
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
export const useB10cksApi = () => {
|
|
4
4
|
const { $b10cksClient } = useNuxtApp();
|
|
@@ -66,6 +66,7 @@ export const useB10cksApi = () => {
|
|
|
66
66
|
...options,
|
|
67
67
|
params,
|
|
68
68
|
transform: (result) => {
|
|
69
|
+
console.log("Content fetched:", result);
|
|
69
70
|
if ("data" in result) {
|
|
70
71
|
return result.data;
|
|
71
72
|
}
|
|
@@ -166,11 +167,18 @@ export const useB10cksApi = () => {
|
|
|
166
167
|
if (!configCache.value) {
|
|
167
168
|
await execute();
|
|
168
169
|
configCache.value = config.value?.content || {};
|
|
170
|
+
console.log("Config fetched:", configCache.value);
|
|
169
171
|
}
|
|
170
172
|
return {
|
|
171
173
|
config: computed(() => configCache.value)
|
|
172
174
|
};
|
|
173
175
|
};
|
|
176
|
+
callOnce(async () => {
|
|
177
|
+
const { data: space, execute } = useSpace({ immediate: false });
|
|
178
|
+
await execute();
|
|
179
|
+
$b10cksClient.setRv(space.value?.rv || 426713400);
|
|
180
|
+
console.log("Space fetched:", space.value);
|
|
181
|
+
});
|
|
174
182
|
return {
|
|
175
183
|
useContent,
|
|
176
184
|
useContents,
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -2,31 +2,39 @@ import { useState } from "#app";
|
|
|
2
2
|
import { ApiClient } from "@b10cks/client";
|
|
3
3
|
import { B10cksVue, previewBridge } from "@b10cks/vue";
|
|
4
4
|
import { defineNuxtPlugin, useRequestURL, useRuntimeConfig } from "nuxt/app";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
nuxtApp
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const b10cksClient = new ApiClient(
|
|
16
|
-
{
|
|
17
|
-
baseUrl: config.public.b10cks.apiUrl || "https://api.b10cks.com/api",
|
|
18
|
-
token: config.public.b10cks.accessToken,
|
|
19
|
-
fetchClient: $fetch,
|
|
20
|
-
getRv: () => rvState.value,
|
|
21
|
-
setRv: (value) => {
|
|
22
|
-
rvState.value = value;
|
|
5
|
+
let rv = 0;
|
|
6
|
+
export default defineNuxtPlugin({
|
|
7
|
+
name: "b10cks",
|
|
8
|
+
setup(nuxtApp) {
|
|
9
|
+
const config = useRuntimeConfig();
|
|
10
|
+
const url = useRequestURL();
|
|
11
|
+
nuxtApp.vueApp.use(B10cksVue);
|
|
12
|
+
if (previewBridge.isInPreviewMode()) {
|
|
13
|
+
if (import.meta.client) {
|
|
14
|
+
previewBridge.init();
|
|
23
15
|
}
|
|
24
|
-
},
|
|
25
|
-
url
|
|
26
|
-
);
|
|
27
|
-
return {
|
|
28
|
-
provide: {
|
|
29
|
-
b10cksClient
|
|
30
16
|
}
|
|
31
|
-
|
|
17
|
+
const rvState = useState("b10cks_rv", () => url.searchParams.get("rv") || rv);
|
|
18
|
+
const b10cksClient = new ApiClient(
|
|
19
|
+
{
|
|
20
|
+
baseUrl: config.public.b10cks.apiUrl || "https://api.b10cks.com/api",
|
|
21
|
+
token: config.public.b10cks.accessToken,
|
|
22
|
+
fetchClient: $fetch,
|
|
23
|
+
rv: rvState.value,
|
|
24
|
+
getRv: () => {
|
|
25
|
+
return rvState.value;
|
|
26
|
+
},
|
|
27
|
+
setRv: (value) => {
|
|
28
|
+
rv = value;
|
|
29
|
+
rvState.value = value;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
url
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
provide: {
|
|
36
|
+
b10cksClient
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
32
40
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b10cks/nuxt",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "b10cks Nuxt module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Michael Wallner @ Coder's Cantina",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@b10cks/client": "^0.10.
|
|
27
|
+
"@b10cks/client": "^0.10.2",
|
|
28
28
|
"@b10cks/vue": "^0.10.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|