@userfrosting/sprinkle-core 6.0.0-alpha.3 → 6.0.0-alpha.4

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.
@@ -2,7 +2,6 @@ export {}
2
2
 
3
3
  declare module 'vue' {
4
4
  interface ComponentCustomProperties {
5
- // TODO : Use interface from sprinkle-core
6
5
  $t: (key: string, placeholders?: string | number | object) => string
7
6
  $tdate: (date: string, format?: string | object) => string
8
7
  }
@@ -4,16 +4,23 @@ import { useConfigStore, useTranslator } from './stores'
4
4
  /**
5
5
  * Core Sprinkle initialization recipe.
6
6
  *
7
- * This recipe is responsible for loading the configuration from the api.
7
+ * This recipe is responsible for loading the configuration from the api,
8
+ * loading the translations and register the translator as $t and $tdate global
9
+ * properties.
8
10
  */
9
11
  export default {
10
12
  install: (app: App) => {
13
+ /**
14
+ * Load configuration
15
+ */
11
16
  useConfigStore().load()
12
17
 
13
- // Load translations & add $t to global properties
14
- const { translate, translateDate, load } = useTranslator()
15
- load()
16
- app.config.globalProperties.$t = translate
17
- app.config.globalProperties.$tdate = translateDate
18
+ /**
19
+ * Load translations & add $t+$tdate to global properties
20
+ */
21
+ const translator = useTranslator()
22
+ translator.load()
23
+ app.config.globalProperties.$t = translator.translate
24
+ app.config.globalProperties.$tdate = translator.translateDate
18
25
  }
19
26
  }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Default error routes.
3
+ *
4
+ * N.B.: The first of these routes serve as a catch-all, so 404 not found must
5
+ * be first.
6
+ */
7
+ export default [
8
+ {
9
+ path: '/:pathMatch(.*)*',
10
+ name: 'NotFound',
11
+ meta: {
12
+ title: 'ERROR.404.TITLE',
13
+ description: 'ERROR.404.DESCRIPTION'
14
+ },
15
+ component: () => import('../views/404NotFound.vue')
16
+ },
17
+ {
18
+ path: '/:pathMatch(.*)*',
19
+ name: 'Unauthorized',
20
+ meta: {
21
+ title: 'ERROR.401.TITLE',
22
+ description: 'ERROR.401.DESCRIPTION'
23
+ },
24
+ component: () => import('../views/401Unauthorized.vue')
25
+ },
26
+ {
27
+ path: '/:pathMatch(.*)*',
28
+ name: 'Forbidden',
29
+ meta: {
30
+ title: 'ERROR.403.TITLE',
31
+ description: 'ERROR.403.DESCRIPTION'
32
+ },
33
+ component: () => import('../views/403Forbidden.vue')
34
+ },
35
+ {
36
+ path: '/:pathMatch(.*)*',
37
+ name: 'Error',
38
+ meta: {
39
+ title: 'ERROR.TITLE',
40
+ description: 'ERROR.DESCRIPTION'
41
+ },
42
+ component: () => import('../views/ErrorPage.vue')
43
+ }
44
+ ]
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <UFErrorPage errorCode="401" />
3
+ </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <UFErrorPage errorCode="403" />
3
+ </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <UFErrorPage errorCode="404" />
3
+ </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <UFErrorPage />
3
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@userfrosting/sprinkle-core",
3
- "version": "6.0.0-alpha.3",
3
+ "version": "6.0.0-alpha.4",
4
4
  "type": "module",
5
5
  "description": "Core Sprinkle for UserFrosting",
6
6
  "funding": "https://opencollective.com/userfrosting",
@@ -27,7 +27,8 @@
27
27
  ".": "./app/assets/index.ts",
28
28
  "./interfaces": "./app/assets/interfaces/index.ts",
29
29
  "./stores": "./app/assets/stores/index.ts",
30
- "./composables": "./app/assets/composables/index.ts"
30
+ "./composables": "./app/assets/composables/index.ts",
31
+ "./routes": "./app/assets/routes/index.ts"
31
32
  },
32
33
  "files": [
33
34
  "app/assets/"