@lenne.tech/nuxt-extensions 1.2.5 → 1.2.6
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.
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { useLtAuth } from "../composables/auth/use-lt-auth.js";
|
|
2
2
|
export default (nuxtApp) => {
|
|
3
3
|
if (import.meta.server) return;
|
|
4
|
-
|
|
4
|
+
let _authInstance = null;
|
|
5
|
+
function getAuth() {
|
|
6
|
+
if (!_authInstance) {
|
|
7
|
+
_authInstance = useLtAuth();
|
|
8
|
+
}
|
|
9
|
+
return _authInstance;
|
|
10
|
+
}
|
|
5
11
|
const runtimeConfig = nuxtApp.$config?.public?.ltExtensions?.auth || {};
|
|
6
12
|
const loginPath = runtimeConfig.loginPath || "/auth/login";
|
|
7
13
|
const configuredPublicPaths = runtimeConfig.interceptor?.publicPaths || [];
|
|
@@ -54,6 +60,7 @@ export default (nuxtApp) => {
|
|
|
54
60
|
}
|
|
55
61
|
isHandling401 = true;
|
|
56
62
|
try {
|
|
63
|
+
const { clearUser, isAuthenticated } = getAuth();
|
|
57
64
|
if (isAuthenticated.value) {
|
|
58
65
|
console.debug("[LtAuth Interceptor] Session expired, logging out...");
|
|
59
66
|
clearUser();
|