@dargmuesli/nuxt-vio 22.0.0-beta.1 → 22.0.0-beta.2
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,10 +6,12 @@ export const useGetServiceHref = () => {
|
|
|
6
6
|
return ({
|
|
7
7
|
isSsr = true,
|
|
8
8
|
name,
|
|
9
|
+
path,
|
|
9
10
|
port,
|
|
10
11
|
}: {
|
|
11
12
|
isSsr?: boolean
|
|
12
13
|
name: string
|
|
14
|
+
path?: string
|
|
13
15
|
port?: number
|
|
14
16
|
}) =>
|
|
15
17
|
getServiceHref({
|
|
@@ -17,6 +19,7 @@ export const useGetServiceHref = () => {
|
|
|
17
19
|
isSsr,
|
|
18
20
|
isTesting,
|
|
19
21
|
name,
|
|
22
|
+
path,
|
|
20
23
|
port,
|
|
21
24
|
stagingHost: runtimeConfig.public.vio.stagingHost,
|
|
22
25
|
})
|
|
@@ -30,3 +33,13 @@ export const useHost = () => {
|
|
|
30
33
|
|
|
31
34
|
return host
|
|
32
35
|
}
|
|
36
|
+
|
|
37
|
+
export const useServiceFetch = (
|
|
38
|
+
options: Parameters<ReturnType<typeof useGetServiceHref>>[0],
|
|
39
|
+
) => {
|
|
40
|
+
const getServiceHref = useGetServiceHref()
|
|
41
|
+
|
|
42
|
+
return $fetch.create({
|
|
43
|
+
baseURL: getServiceHref(options),
|
|
44
|
+
})
|
|
45
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export const useStrapiFetch = (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export const useStrapiFetch = (
|
|
2
|
+
options?: Parameters<ReturnType<typeof useGetServiceHref>>[0],
|
|
3
|
+
) =>
|
|
4
|
+
useServiceFetch({
|
|
5
|
+
...(options ? options : {}),
|
|
6
|
+
name: options?.name || 'strapi',
|
|
7
|
+
path: options?.path || '/api',
|
|
6
8
|
})
|
|
7
|
-
}
|
package/package.json
CHANGED
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"url": "git+https://github.com/dargmuesli/vio.git"
|
|
98
98
|
},
|
|
99
99
|
"type": "module",
|
|
100
|
-
"version": "22.0.0-beta.
|
|
100
|
+
"version": "22.0.0-beta.2",
|
|
101
101
|
"scripts": {
|
|
102
102
|
"build": "pnpm run build:node",
|
|
103
103
|
"build:node": "NUXT_PUBLIC_I18N_BASE_URL=https://app.localhost:3001 nuxt build playground",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DARGSTACK_SECRET_UNUSED_THIRD_PARTY = 'UNSET THIRD PARTY SECRET'
|
|
@@ -8,10 +8,12 @@ export const useGetServiceHref = ({ event }: { event?: H3Event } = {}) => {
|
|
|
8
8
|
return ({
|
|
9
9
|
isSsr = true,
|
|
10
10
|
name,
|
|
11
|
+
path,
|
|
11
12
|
port,
|
|
12
13
|
}: {
|
|
13
14
|
isSsr?: boolean
|
|
14
15
|
name: string
|
|
16
|
+
path?: string
|
|
15
17
|
port?: number
|
|
16
18
|
}) =>
|
|
17
19
|
getServiceHref({
|
|
@@ -19,6 +21,7 @@ export const useGetServiceHref = ({ event }: { event?: H3Event } = {}) => {
|
|
|
19
21
|
isSsr,
|
|
20
22
|
isTesting,
|
|
21
23
|
name,
|
|
24
|
+
path,
|
|
22
25
|
port,
|
|
23
26
|
stagingHost: runtimeConfig.public.vio.stagingHost,
|
|
24
27
|
})
|
|
@@ -90,6 +90,7 @@ export const getServiceHref = ({
|
|
|
90
90
|
isSsr = true,
|
|
91
91
|
isTesting,
|
|
92
92
|
name,
|
|
93
|
+
path,
|
|
93
94
|
port,
|
|
94
95
|
stagingHost,
|
|
95
96
|
}: {
|
|
@@ -97,6 +98,7 @@ export const getServiceHref = ({
|
|
|
97
98
|
isSsr?: boolean
|
|
98
99
|
isTesting?: boolean
|
|
99
100
|
name: string
|
|
101
|
+
path?: string
|
|
100
102
|
port?: number
|
|
101
103
|
stagingHost?: string
|
|
102
104
|
}) => {
|
|
@@ -104,21 +106,22 @@ export const getServiceHref = ({
|
|
|
104
106
|
name !== VIO_SITE_NAME ? name?.replaceAll('_', '-') : undefined
|
|
105
107
|
const nameSubdomainString = nameSubdomain ? `${nameSubdomain}.` : ''
|
|
106
108
|
const portString = port ? `:${port}` : ''
|
|
109
|
+
const pathString = path ? `/${path.replace(/^\/+/, '')}` : ''
|
|
107
110
|
|
|
108
111
|
if (isTesting) {
|
|
109
|
-
return `${SITE_URL_TYPED.protocol}//${nameSubdomainString}${SITE_URL_TYPED.host}`
|
|
112
|
+
return `${SITE_URL_TYPED.protocol}//${nameSubdomainString}${SITE_URL_TYPED.host}${pathString}`
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
if (stagingHost) {
|
|
113
|
-
return `https://${nameSubdomainString}${stagingHost}`
|
|
116
|
+
return `https://${nameSubdomainString}${stagingHost}${pathString}`
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
if (import.meta.server && isSsr) {
|
|
117
|
-
return `http://${name}${portString}`
|
|
120
|
+
return `http://${name}${portString}${pathString}`
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
if (host) {
|
|
121
|
-
return `https://${nameSubdomainString}${host}`
|
|
124
|
+
return `https://${nameSubdomainString}${host}${pathString}`
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
throw new Error('Could not get service href!')
|