@hostlink/nuxt-light 0.0.51 → 0.0.52
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 +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.mjs +2 -1
- package/dist/runtime/lib/getApiUrl.mjs +2 -1
- package/dist/runtime/lib/index.d.ts +2 -1
- package/dist/runtime/lib/index.mjs +7 -1
- package/dist/runtime/lib/m.mjs +5 -2
- package/dist/runtime/lib/q.mjs +4 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/runtime/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ interface Light {
|
|
|
7
7
|
getVersion(): string;
|
|
8
8
|
}
|
|
9
9
|
export declare function useLight(): Light;
|
|
10
|
-
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, getID, deleteObject, listObject } from "./lib";
|
|
10
|
+
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, getID, deleteObject, listObject, getApiBase } from "./lib";
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -18,4 +18,5 @@ import listObject from "./listObject";
|
|
|
18
18
|
import isGranted from "./isGranted";
|
|
19
19
|
declare const notify: (message: string, color?: string) => void;
|
|
20
20
|
import getID from "./getID";
|
|
21
|
-
|
|
21
|
+
declare const getApiBase: () => {};
|
|
22
|
+
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject, isGranted, getApiBase };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
1
2
|
import { Notify } from "quasar";
|
|
2
3
|
import addObject from "./addObject.mjs";
|
|
3
4
|
import f from "./f.mjs";
|
|
@@ -25,6 +26,10 @@ const notify = function(message, color = "green") {
|
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
import getID from "./getID.mjs";
|
|
29
|
+
const getApiBase = () => {
|
|
30
|
+
const config = useRuntimeConfig();
|
|
31
|
+
return config?.public?.apiBase ?? "/api/";
|
|
32
|
+
};
|
|
28
33
|
export {
|
|
29
34
|
addObject,
|
|
30
35
|
f,
|
|
@@ -45,5 +50,6 @@ export {
|
|
|
45
50
|
getID,
|
|
46
51
|
deleteObject,
|
|
47
52
|
listObject,
|
|
48
|
-
isGranted
|
|
53
|
+
isGranted,
|
|
54
|
+
getApiBase
|
|
49
55
|
};
|
package/dist/runtime/lib/m.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
3
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
4
|
+
import { getApiBase } from "./index.mjs";
|
|
3
5
|
export default async function(operation, args, fields = []) {
|
|
6
|
+
const config = useRuntimeConfig();
|
|
4
7
|
const mutation = {
|
|
5
8
|
mutation: {}
|
|
6
9
|
};
|
|
@@ -42,9 +45,9 @@ export default async function(operation, args, fields = []) {
|
|
|
42
45
|
for (let i = 0; i < map_values.length; i++) {
|
|
43
46
|
fd.append(i.toString(), map_values[i]);
|
|
44
47
|
}
|
|
45
|
-
data = (await service.post(
|
|
48
|
+
data = (await service.post(getApiBase(), fd)).data;
|
|
46
49
|
} else {
|
|
47
|
-
data = (await service.post(
|
|
50
|
+
data = (await service.post(getApiBase(), {
|
|
48
51
|
query: graphql_query
|
|
49
52
|
})).data;
|
|
50
53
|
}
|
package/dist/runtime/lib/q.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import f from "./f.mjs";
|
|
3
3
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
4
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
5
|
+
import { getApiBase } from "./index.mjs";
|
|
4
6
|
const mapping = function(obj) {
|
|
5
7
|
let q = {};
|
|
6
8
|
Object.entries(obj).forEach(([key, value]) => {
|
|
@@ -16,6 +18,7 @@ const mapping = function(obj) {
|
|
|
16
18
|
return q;
|
|
17
19
|
};
|
|
18
20
|
export default async function(operation, args, fields = []) {
|
|
21
|
+
const config = useRuntimeConfig();
|
|
19
22
|
const service = axios.create({
|
|
20
23
|
withCredentials: true
|
|
21
24
|
});
|
|
@@ -29,7 +32,7 @@ export default async function(operation, args, fields = []) {
|
|
|
29
32
|
}
|
|
30
33
|
query = f(operation, args, fields);
|
|
31
34
|
}
|
|
32
|
-
const resp = (await service.post(
|
|
35
|
+
const resp = (await service.post(getApiBase(), {
|
|
33
36
|
query: `{ ${query} }`
|
|
34
37
|
})).data;
|
|
35
38
|
if (resp.errors) {
|