@finema/finework-layer 0.2.75 → 0.2.77

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 (51) hide show
  1. package/.husky/pre-commit +1 -1
  2. package/.playground/.env.example +5 -0
  3. package/.playground/app/assets/css/main.css +6 -6
  4. package/.playground/app/pages/layout-admin/[id]/index.vue +145 -145
  5. package/.playground/app/pages/layout-admin/test/[id]/index.vue +286 -286
  6. package/.playground/app/pages/layout-admin.vue +285 -285
  7. package/.playground/app/pages/layout-user.vue +284 -0
  8. package/.playground/app/pages/submenu/layout-admin.vue +210 -210
  9. package/.playground/public/admin/clock-in-admin-logo.png +0 -0
  10. package/.playground/public/admin/clock-in-logo.png +0 -0
  11. package/.playground/public/admin/clock-in.png +0 -0
  12. package/.playground/public/admin/pmo-logo.png +0 -0
  13. package/.playground/public/admin/spider-web.png +0 -0
  14. package/.playground/public/admin/super-admin-logo.png +0 -0
  15. package/.playground/public/admin/super-admin.png +0 -0
  16. package/.playground/public/admin/timesheet-admin-logo.png +0 -0
  17. package/.playground/public/admin/timesheet-logo.png +0 -0
  18. package/.playground/public/admin/timesheet.png +0 -0
  19. package/CHANGELOG.md +378 -364
  20. package/app/app.config.ts +144 -144
  21. package/app/app.vue +10 -10
  22. package/app/assets/css/main.css +77 -77
  23. package/app/components/Button/ActionIcon.vue +29 -29
  24. package/app/components/Button/Back.vue +22 -22
  25. package/app/components/Format/Currency.vue +17 -17
  26. package/app/components/Format/Date.vue +24 -24
  27. package/app/components/Format/DateTime.vue +24 -24
  28. package/app/components/Format/Number.vue +17 -17
  29. package/app/components/Format/Percent.vue +38 -38
  30. package/app/components/Format/TimeFromNow.vue +38 -38
  31. package/app/components/InfoItemList.vue +196 -196
  32. package/app/components/Layout/Admin/Sidebar.vue +329 -329
  33. package/app/components/Layout/Admin/index.vue +224 -270
  34. package/app/components/Layout/Apps.vue +45 -45
  35. package/app/components/Layout/User/index.vue +102 -145
  36. package/app/components/Notifications/index.vue +162 -0
  37. package/app/components/StatusBox.vue +56 -56
  38. package/app/composables/useAuth.ts +207 -207
  39. package/app/composables/useNotification.ts +76 -0
  40. package/app/composables/useRequestOptions.ts +86 -86
  41. package/app/constants/routes.ts +86 -86
  42. package/app/error.vue +218 -218
  43. package/app/middleware/auth.ts +45 -45
  44. package/app/middleware/common.ts +12 -12
  45. package/app/middleware/guest.ts +7 -7
  46. package/app/middleware/permissions.ts +29 -29
  47. package/bun.lock +2758 -2758
  48. package/index.d.ts +16 -16
  49. package/nuxt.config.ts +41 -41
  50. package/package.json +38 -38
  51. package/app/components/NotificationList.vue +0 -65
@@ -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
+ })