una-nuxt-module 3.0.9 → 3.0.11
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtRouteMiddleware, navigateTo } from "#app";
|
|
1
|
+
import { defineNuxtRouteMiddleware, navigateTo, useNuxtApp } from "#app";
|
|
2
2
|
import { useAuthStore } from "../stores/auth.js";
|
|
3
3
|
import { useFormModeTrackerStore } from "../stores/formModeTracker.js";
|
|
4
4
|
import { useAuthorization } from "../composables/useAuthorization.js";
|
|
@@ -20,11 +20,13 @@ export default defineNuxtRouteMiddleware((to) => {
|
|
|
20
20
|
if (authorization.isPageUnprotected(resource)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
const { $pinia } = useNuxtApp();
|
|
24
|
+
const authStore = useAuthStore($pinia);
|
|
25
|
+
if (!authStore.isAuthenticated) {
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
28
|
if (isUserGoingToForm(resource)) {
|
|
27
|
-
const formModeTrackerStore = useFormModeTrackerStore();
|
|
29
|
+
const formModeTrackerStore = useFormModeTrackerStore($pinia);
|
|
28
30
|
const params = {
|
|
29
31
|
resource: getPathWhitoutFormPart(resource),
|
|
30
32
|
authorization: formModeTrackerStore.formMode
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig, useNuxtApp } from "#app";
|
|
2
2
|
import {
|
|
3
3
|
AsgardeoSPAClient,
|
|
4
4
|
Hooks
|
|
@@ -24,8 +24,9 @@ export default defineNuxtPlugin(() => {
|
|
|
24
24
|
auth?.signIn();
|
|
25
25
|
}
|
|
26
26
|
auth?.on(Hooks.SignIn, async (response) => {
|
|
27
|
+
const { $pinia } = useNuxtApp();
|
|
28
|
+
const authStore = useAuthStore($pinia);
|
|
27
29
|
const authorization = useAuthorization();
|
|
28
|
-
const authStore = useAuthStore();
|
|
29
30
|
const getUserInfo = () => {
|
|
30
31
|
if (response?.email) {
|
|
31
32
|
const email = Array.isArray(response?.email) ? response?.email[0] : response?.email;
|