@finema/finework-layer 0.2.77 → 0.2.78

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.
Files changed (41) hide show
  1. package/.husky/pre-commit +1 -1
  2. package/.playground/app/assets/css/main.css +6 -6
  3. package/.playground/app/pages/layout-admin/[id]/index.vue +145 -145
  4. package/.playground/app/pages/layout-admin/test/[id]/index.vue +286 -286
  5. package/.playground/app/pages/layout-admin.vue +283 -285
  6. package/.playground/app/pages/layout-user.vue +284 -284
  7. package/.playground/app/pages/submenu/layout-admin.vue +210 -210
  8. package/.vscode/settings.json +5 -1
  9. package/CHANGELOG.md +380 -374
  10. package/app/app.config.ts +144 -144
  11. package/app/app.vue +10 -10
  12. package/app/assets/css/main.css +77 -77
  13. package/app/components/Button/ActionIcon.vue +29 -29
  14. package/app/components/Button/Back.vue +22 -22
  15. package/app/components/Format/Currency.vue +17 -17
  16. package/app/components/Format/Date.vue +24 -24
  17. package/app/components/Format/DateTime.vue +24 -24
  18. package/app/components/Format/Number.vue +17 -17
  19. package/app/components/Format/Percent.vue +38 -38
  20. package/app/components/Format/TimeFromNow.vue +38 -38
  21. package/app/components/InfoItemList.vue +196 -196
  22. package/app/components/Layout/Admin/Sidebar.vue +343 -329
  23. package/app/components/Layout/Admin/index.vue +240 -224
  24. package/app/components/Layout/Apps.vue +45 -45
  25. package/app/components/Layout/User/index.vue +102 -102
  26. package/app/components/Notifications/index.vue +162 -162
  27. package/app/components/StatusBox.vue +56 -56
  28. package/app/composables/useAuth.ts +207 -207
  29. package/app/composables/useNotification.ts +76 -76
  30. package/app/composables/useRequestOptions.ts +86 -86
  31. package/app/constants/routes.ts +86 -86
  32. package/app/error.vue +218 -218
  33. package/app/middleware/auth.ts +45 -45
  34. package/app/middleware/common.ts +12 -12
  35. package/app/middleware/guest.ts +7 -7
  36. package/app/middleware/permissions.ts +29 -29
  37. package/bun.lock +2758 -2758
  38. package/eslint.config.js +206 -2
  39. package/index.d.ts +16 -16
  40. package/nuxt.config.ts +41 -41
  41. package/package.json +38 -38
@@ -1,29 +1,29 @@
1
- import { defineNuxtRouteMiddleware, useAuth, navigateTo, abortNavigation } from '#imports'
2
-
3
- export interface AccessGuardOptions {
4
- permissions?: `${UserModule}:${Permission}`[]
5
- redirectTo?: string
6
- }
7
-
8
- export default defineNuxtRouteMiddleware(async (to, from) => {
9
- const options: AccessGuardOptions = to.meta.accessGuard || {}
10
- const auth = useAuth()
11
-
12
- if (
13
- options.permissions?.some((perm) => {
14
- const [module, permission] = perm.split(':') as [UserModule, Permission]
15
-
16
- return auth.hasPermission(module, permission)
17
- })
18
- ) {
19
- return
20
- }
21
-
22
- if (options.redirectTo) {
23
- return navigateTo(options.redirectTo)
24
- }
25
-
26
- return abortNavigation({
27
- statusCode: 403,
28
- })
29
- })
1
+ import { defineNuxtRouteMiddleware, useAuth, navigateTo, abortNavigation } from '#imports'
2
+
3
+ export interface AccessGuardOptions {
4
+ permissions?: `${UserModule}:${Permission}`[]
5
+ redirectTo?: string
6
+ }
7
+
8
+ export default defineNuxtRouteMiddleware(async (to, from) => {
9
+ const options: AccessGuardOptions = to.meta.accessGuard || {}
10
+ const auth = useAuth()
11
+
12
+ if (
13
+ options.permissions?.some((perm) => {
14
+ const [module, permission] = perm.split(':') as [UserModule, Permission]
15
+
16
+ return auth.hasPermission(module, permission)
17
+ })
18
+ ) {
19
+ return
20
+ }
21
+
22
+ if (options.redirectTo) {
23
+ return navigateTo(options.redirectTo)
24
+ }
25
+
26
+ return abortNavigation({
27
+ statusCode: 403,
28
+ })
29
+ })