@inzombieland/nuxt-common 1.19.1 → 1.19.3
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
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.19.
|
|
5
|
+
const version = "1.19.3";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useApiActions, useUser, useVisitor } from "./composables/index.mjs";
|
|
1
|
+
import { useActiveSessions, useApiActions, useUser, useVisitor } from "./composables/index.mjs";
|
|
2
2
|
import { apiHelper, once } from "./helpers/index.mjs";
|
|
3
3
|
import { useBus } from "./index.mjs";
|
|
4
4
|
let token = null;
|
|
@@ -23,6 +23,8 @@ export const setToken = (newToken) => {
|
|
|
23
23
|
export const flush = () => {
|
|
24
24
|
setToken(null);
|
|
25
25
|
setUser(null);
|
|
26
|
+
const activeSessions = useActiveSessions();
|
|
27
|
+
activeSessions.value = [];
|
|
26
28
|
};
|
|
27
29
|
const eventHandler = (requestID, eventName) => {
|
|
28
30
|
return new Promise((resolve, reject) => {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ref
|
|
1
|
+
import { ref } from "vue";
|
|
2
2
|
import { useUserActions } from "../index.mjs";
|
|
3
|
-
import { useUser } from "./use-user.mjs";
|
|
4
3
|
const activeSessions = ref([]);
|
|
5
4
|
export function useActiveSessions() {
|
|
6
|
-
const user = useUser();
|
|
7
5
|
const userActions = useUserActions();
|
|
8
6
|
const fetchActiveSessions = async () => {
|
|
9
7
|
if (activeSessions.value.length === 0) {
|
|
@@ -12,10 +10,5 @@ export function useActiveSessions() {
|
|
|
12
10
|
}
|
|
13
11
|
};
|
|
14
12
|
fetchActiveSessions();
|
|
15
|
-
watch(user, (user2) => {
|
|
16
|
-
if (!user2) {
|
|
17
|
-
activeSessions.value = [];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
13
|
return activeSessions;
|
|
21
14
|
}
|