@inzombieland/nuxt-common 1.16.25 → 1.16.27
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 +1 -1
- package/dist/runtime/composables/use-active-sessions.d.ts +3 -5
- package/dist/runtime/composables/use-active-sessions.mjs +3 -15
- package/dist/runtime/packages/api/index.d.ts +1 -0
- package/dist/runtime/packages/api/index.mjs +1 -0
- package/dist/runtime/packages/api/init-application.mjs +1 -1
- package/dist/runtime/packages/api/package.json +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { defineNuxtModule, createResolver, addServerHandler, addImportsDir, addPlugin, addComponent } from '@nuxt/kit';
|
|
3
3
|
|
|
4
4
|
const name = "@inzombieland/nuxt-common";
|
|
5
|
-
const version = "1.16.
|
|
5
|
+
const version = "1.16.27";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
declare const _default: () => Ref<ActiveSession[], ActiveSession[]>;
|
|
5
|
-
export default _default;
|
|
1
|
+
import { useActiveSessions } from "../packages/api";
|
|
2
|
+
export { useActiveSessions };
|
|
3
|
+
export default useActiveSessions;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const useActiveSessions = () => useState("activeSessions", () => []);
|
|
5
|
-
export default () => {
|
|
6
|
-
const { fetchActiveSessions } = useUserActions();
|
|
7
|
-
const activeSessions = useActiveSessions();
|
|
8
|
-
onMounted(async () => {
|
|
9
|
-
if (activeSessions.value.length === 0) {
|
|
10
|
-
const data = await fetchActiveSessions();
|
|
11
|
-
activeSessions.value = data?.sessions ?? [];
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return activeSessions;
|
|
15
|
-
};
|
|
1
|
+
import { useActiveSessions } from "../packages/api/index.mjs";
|
|
2
|
+
export { useActiveSessions };
|
|
3
|
+
export default useActiveSessions;
|
|
@@ -3,6 +3,7 @@ import type { ActiveSession, Fetch, FetchConfig, User } from "./types";
|
|
|
3
3
|
export type { ActiveSession, Fetch, FetchConfig, User };
|
|
4
4
|
export { useUser } from "./composables/use-user";
|
|
5
5
|
export { useSubscribe } from "./composables/use-subscribe";
|
|
6
|
+
export { useActiveSessions } from "./composables/use-active-sessions";
|
|
6
7
|
export { getVisitor, getVisitorId, type Visitor } from "./get-visitor";
|
|
7
8
|
export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
8
9
|
fetch: Fetch;
|
|
@@ -11,6 +11,7 @@ import { createApiRefreshToken } from "./refresh-token.mjs";
|
|
|
11
11
|
import { createApiUserActions } from "./user-actions.mjs";
|
|
12
12
|
export { useUser } from "./composables/use-user.mjs";
|
|
13
13
|
export { useSubscribe } from "./composables/use-subscribe.mjs";
|
|
14
|
+
export { useActiveSessions } from "./composables/use-active-sessions.mjs";
|
|
14
15
|
export { getVisitor, getVisitorId } from "./get-visitor.mjs";
|
|
15
16
|
const apiActions = useApiActions();
|
|
16
17
|
let userActions;
|
|
@@ -12,6 +12,7 @@ import { useUser } from "./composables/use-user.mjs";
|
|
|
12
12
|
import { once } from "./helpers/index.mjs";
|
|
13
13
|
import { getVisitorId, useUserActions } from "./index.mjs";
|
|
14
14
|
function initApplication() {
|
|
15
|
+
const router = useRouter();
|
|
15
16
|
const user = useUser();
|
|
16
17
|
const theme = useLocalStorage("app-preferences-theme", JSON.stringify({ value: "" }));
|
|
17
18
|
const locale = useLocalStorage("app-preferences-locale", JSON.stringify({ value: "en" }));
|
|
@@ -83,7 +84,6 @@ function initApplication() {
|
|
|
83
84
|
const isCurrentSession = data?.sessions.some((s) => s.isCurrentSession && s.id === session?.sessionId);
|
|
84
85
|
if (isCurrentSession) {
|
|
85
86
|
await userActions?.value.logout();
|
|
86
|
-
const router = useRouter();
|
|
87
87
|
await router.push({ path: "/" });
|
|
88
88
|
}
|
|
89
89
|
}
|