nuxt-directus-sdk 5.0.0 → 5.0.1-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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -3
- package/dist/runtime/plugin.js +8 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useLogger, defineNuxtModule, createResolver, addServerHandler,
|
|
1
|
+
import { useLogger, defineNuxtModule, createResolver, addServerHandler, hasNuxtModule, tryResolveModule, addPlugin, addRouteMiddleware, addImportsDir, addComponentsDir, addImportsSources, addTypeTemplate, installModule } from '@nuxt/kit';
|
|
2
2
|
import { colors } from 'consola/utils';
|
|
3
3
|
import { defu } from 'defu';
|
|
4
4
|
import { joinURL } from 'ufo';
|
|
@@ -6,7 +6,7 @@ import { generateTypes } from '../dist/runtime/types/index.js';
|
|
|
6
6
|
import { useUrl } from '../dist/runtime/utils/index.js';
|
|
7
7
|
|
|
8
8
|
const name = "nuxt-directus-sdk";
|
|
9
|
-
const version = "5.0.
|
|
9
|
+
const version = "5.0.1-beta.2";
|
|
10
10
|
|
|
11
11
|
const configKey = "directus";
|
|
12
12
|
const logger = useLogger("nuxt-directus-sdk");
|
|
@@ -140,7 +140,8 @@ const module$1 = defineNuxtModule({
|
|
|
140
140
|
delete nuxtApp.options.runtimeConfig.public[configKey].serverDirectusUrl;
|
|
141
141
|
const imageConfig = typeof options.image === "boolean" ? { enabled: options.image } : options.image;
|
|
142
142
|
const imageEnabled = imageConfig?.enabled ?? true;
|
|
143
|
-
|
|
143
|
+
const hasNuxtImage = imageEnabled && (hasNuxtModule("@nuxt/image") || await tryResolveModule("@nuxt/image", new URL(import.meta.url)));
|
|
144
|
+
if (hasNuxtImage) {
|
|
144
145
|
const { setDefaultProvider, modifiers } = imageConfig || {};
|
|
145
146
|
const imageBaseUrl = devProxyEnabled ? `${devProxyPath}/assets` : useUrl(clientUrl, "assets");
|
|
146
147
|
await registerModule("@nuxt/image", "image", {
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -37,11 +37,15 @@ export default defineNuxtPlugin({
|
|
|
37
37
|
if (authEnabled) {
|
|
38
38
|
const sessionCookie = useCookie("directus_session_token");
|
|
39
39
|
const directusUrlCookie = useCookie("directus_instance_url");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (sessionCookie.value) {
|
|
41
|
+
const currentDirectusUrl = useDirectusOriginUrl();
|
|
42
|
+
if (directusUrlCookie.value !== currentDirectusUrl) {
|
|
43
|
+
if (directusUrlCookie.value) {
|
|
44
|
+
sessionCookie.value = null;
|
|
45
|
+
}
|
|
46
|
+
directusUrlCookie.value = currentDirectusUrl;
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
|
-
directusUrlCookie.value = currentDirectusUrl;
|
|
45
49
|
if (directusAuth.user.value === null && sessionCookie.value) {
|
|
46
50
|
const user = await directusAuth.readMe();
|
|
47
51
|
await nuxtApp.callHook("directus:loggedIn", user);
|
package/package.json
CHANGED