una-nuxt-module 3.0.34 → 3.0.36

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "una-nuxt-module",
3
- "version": "3.0.34",
3
+ "version": "3.0.36",
4
4
  "configKey": "unaxt",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.0.0"
package/dist/module.mjs CHANGED
@@ -167,7 +167,7 @@ function addTemplates() {
167
167
  }
168
168
 
169
169
  const name = "una-nuxt-module";
170
- const version = "3.0.34";
170
+ const version = "3.0.36";
171
171
 
172
172
  const module$1 = defineNuxtModule({
173
173
  meta: {
@@ -1,6 +1,7 @@
1
- import { computed, ref, useNuxtApp } from "#imports";
1
+ import { computed, ref, useNuxtApp, useRuntimeConfig } from "#imports";
2
2
  import { defineStore } from "pinia";
3
3
  import { EAuthorization } from "../../enums/EAuthorization.js";
4
+ const LOGOUT_ENDPOINT = "/api/usuario/logout";
4
5
  export const useAuthStore = defineStore("AuthStore", () => {
5
6
  const user = ref(null);
6
7
  const authData = ref(null);
@@ -10,29 +11,45 @@ export const useAuthStore = defineStore("AuthStore", () => {
10
11
  const token = computed(() => authData.value?.accessToken ?? null);
11
12
  const logout = async () => {
12
13
  const { $signOut } = useNuxtApp();
13
- await $signOut();
14
+ const runtimeConfig = useRuntimeConfig();
15
+ const baseURL = runtimeConfig.public.apiBaseUrl;
16
+ try {
17
+ await $fetch(LOGOUT_ENDPOINT, {
18
+ baseURL,
19
+ method: "DELETE",
20
+ headers: {
21
+ Authorization: `Bearer ${token.value}`
22
+ }
23
+ });
24
+ } catch (error) {
25
+ console.error("Error en logout:", error);
26
+ } finally {
27
+ await $signOut();
28
+ }
14
29
  };
15
30
  const update = (userInfo, data) => {
16
31
  user.value = userInfo;
17
32
  authData.value = data;
18
33
  };
19
34
  const hasResource = (resource) => {
20
- return !!authData.value?.resources?.find((r) => r.nombre === resource);
35
+ return authData.value?.resources?.some(
36
+ (currentResource) => currentResource.nombre === resource
37
+ ) ?? false;
21
38
  };
22
39
  const hasAuthorizationInResource = ({
23
40
  resource,
24
41
  authorization
25
42
  }) => {
26
43
  const resourceData = authData.value?.resources.find(
27
- (r) => r.nombre === resource
44
+ (currentResource) => currentResource.nombre === resource
28
45
  );
29
46
  if (!resourceData) return false;
30
- const permissions = /* @__PURE__ */ new Map([
31
- [EAuthorization.CREATE, resourceData.permisoInsertar],
32
- [EAuthorization.EDIT, resourceData.permisoModificar],
33
- [EAuthorization.DELETE, resourceData.permisoEliminar]
34
- ]);
35
- return permissions.get(authorization) ?? false;
47
+ const permissions = {
48
+ [EAuthorization.CREATE]: resourceData.permisoInsertar,
49
+ [EAuthorization.EDIT]: resourceData.permisoModificar,
50
+ [EAuthorization.DELETE]: resourceData.permisoEliminar
51
+ };
52
+ return permissions[authorization] ?? false;
36
53
  };
37
54
  return {
38
55
  user,
@@ -29,7 +29,7 @@ const props = defineProps({
29
29
  dir: { type: String, required: false },
30
30
  nextPage: { type: Function, required: false },
31
31
  prevPage: { type: Function, required: false },
32
- modelValue: { type: null, required: false, default: void 0 },
32
+ modelValue: { type: [Object, Array, null], required: false, default: void 0 },
33
33
  multiple: { type: Boolean, required: false },
34
34
  disableDaysOutsideCurrentView: { type: Boolean, required: false },
35
35
  asChild: { type: Boolean, required: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "una-nuxt-module",
3
- "version": "3.0.34",
3
+ "version": "3.0.36",
4
4
  "description": "Módulo Nuxt para desarrollo CGI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -65,9 +65,9 @@
65
65
  "@nuxt/a11y": "1.0.0-alpha.1",
66
66
  "@nuxt/fonts": "0.14.0",
67
67
  "@nuxt/hints": "1.1.2",
68
- "@nuxt/icon": "2.2.2",
68
+ "@nuxt/icon": "2.2.3",
69
69
  "@nuxt/image": "2.0.0",
70
- "@nuxt/kit": "4.4.6",
70
+ "@nuxt/kit": "4.4.7",
71
71
  "@nuxtjs/i18n": "10.4.0",
72
72
  "@pinia/nuxt": "0.5.5",
73
73
  "@tailwindcss/vite": "4.3.0",
@@ -84,7 +84,7 @@
84
84
  "lucide-vue-next": "1.0.0",
85
85
  "nuxt-security": "2.6.0",
86
86
  "pinia": "2.2.8",
87
- "reka-ui": "2.9.7",
87
+ "reka-ui": "2.9.9",
88
88
  "scule": "1.3.0",
89
89
  "tailwind-merge": "3.6.0",
90
90
  "tailwindcss": "4.3.0",
@@ -99,25 +99,25 @@
99
99
  "@nuxt/devtools": "3.2.4",
100
100
  "@nuxt/eslint-config": "1.15.2",
101
101
  "@nuxt/module-builder": "1.0.2",
102
- "@nuxt/schema": "4.4.6",
102
+ "@nuxt/schema": "4.4.7",
103
103
  "@nuxt/test-utils": "4.0.3",
104
104
  "@nuxtjs/color-mode": "4.0.0",
105
105
  "@types/node": "24.3.1",
106
- "@typescript-eslint/parser": "8.59.4",
106
+ "@typescript-eslint/parser": "8.60.1",
107
107
  "changelogen": "0.6.2",
108
108
  "eslint": "9.39.1",
109
109
  "eslint-plugin-security": "3.0.1",
110
110
  "husky": "9.1.7",
111
- "lint-staged": "17.0.5",
112
- "nuxt": "4.4.6",
111
+ "lint-staged": "17.0.7",
112
+ "nuxt": "4.4.7",
113
113
  "prettier": "3.8.3",
114
114
  "prettier-plugin-tailwindcss": "0.8.0",
115
- "shadcn-nuxt": "2.7.3",
115
+ "shadcn-nuxt": "2.7.4",
116
116
  "typescript": "~5.9.2",
117
117
  "unaxt-eslint-config": "0.0.3",
118
- "vitest": "4.1.7",
119
- "vue-eslint-parser": "10.4.0",
120
- "vue-tsc": "3.3.1"
118
+ "vitest": "4.1.8",
119
+ "vue-eslint-parser": "10.4.1",
120
+ "vue-tsc": "3.3.3"
121
121
  },
122
122
  "lint-staged": {
123
123
  "*.{js,ts,json,vue}": [