File tree Expand file tree Collapse file tree 9 files changed +57
-15
lines changed
sprinkle-account/app/assets Expand file tree Collapse file tree 9 files changed +57
-15
lines changed Original file line number Diff line number Diff line change 11/// <reference types="vite/client" />
22/// <reference types="@userfrosting/sprinkle-core" />
3+ /// <reference types="@userfrosting/sprinkle-account" />
34/// <reference types="@userfrosting/theme-pink-cupcake/components" />
5+
46/**
57 * This is required for webpack to correctly import vue file when using TypeScript.
68 */
Original file line number Diff line number Diff line change 1+ export { }
2+
3+ declare module 'vue' {
4+ interface ComponentCustomProperties {
5+ $checkAccess : ( slug : string ) => Boolean
6+ }
7+ }
Original file line number Diff line number Diff line change @@ -3,15 +3,29 @@ import type { Router } from 'vue-router'
33import { useAuthStore } from './stores/auth'
44import { useAuthGuard } from './guards/authGuard'
55
6- /* Install plugins */
6+ /**
7+ * Account Sprinkle initialization recipe.
8+ *
9+ * This recipe is responsible for running the auth check on load, setting up
10+ * the router guards and registering the checkAccess as a global properties.
11+ */
712export default {
813 install : ( app : App , options : { router : Router } ) => {
9- // Run auth check on load
14+ /**
15+ * Run auth check on load
16+ */
1017 const auth = useAuthStore ( )
1118 auth . check ( )
1219
13- // Setup router guards
20+ /**
21+ * Setup router guards
22+ */
1423 const { router } = options
1524 useAuthGuard ( router )
25+
26+ /**
27+ * Register checkAccess as a global property
28+ */
29+ app . config . globalProperties . $checkAccess = auth . checkAccess
1630 }
1731}
Original file line number Diff line number Diff line change 1- /* Install plugins */
1+ /**
2+ * Admin Sprinkle initialization recipe.
3+ */
24export default {
35 install : ( ) => { }
46}
Original file line number Diff line number Diff line change 11/// <reference types="vite/client" />
22/// <reference types="@userfrosting/sprinkle-core" />
3+ /// <reference types="@userfrosting/sprinkle-account" />
34
45import { createPinia } from 'pinia'
56import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ export {}
22
33declare module 'vue' {
44 interface ComponentCustomProperties {
5- // TODO : Use interface from sprinkle-core
65 $t : ( key : string , placeholders ?: string | number | object ) => string
76 $tdate : ( date : string , format ?: string | object ) => string
87 }
Original file line number Diff line number Diff line change @@ -4,16 +4,23 @@ import { useConfigStore, useTranslator } from './stores'
44/**
55 * Core Sprinkle initialization recipe.
66 *
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.
810 */
911export default {
1012 install : ( app : App ) => {
13+ /**
14+ * Load configuration
15+ */
1116 useConfigStore ( ) . load ( )
1217
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
1825 }
1926}
Original file line number Diff line number Diff line change 11/// <reference types="vite/client" />
22/// <reference types="@userfrosting/sprinkle-core" />
3+ /// <reference types="@userfrosting/sprinkle-account" />
34
45import { createPinia } from 'pinia'
56import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
Original file line number Diff line number Diff line change 11import type { App } from 'vue'
22
3- // Import sub-plugins
3+ /**
4+ * Import sub-plugins.
5+ */
46import PinkCupcakeComponents from './plugins/components'
57import AdminSprinkle from './plugins/admin'
68import AccountSprinkle from './plugins/account'
79import CoreSprinkle from './plugins/core'
810import FontAwesome from './plugins/font-awesome'
911
10- // Init UIkit
12+ /**
13+ * Import UIkit and its icons.
14+ */
1115import UIkit from 'uikit'
1216import Icons from 'uikit/dist/js/uikit-icons'
1317UIkit . use ( Icons )
1418
15- /* Install plugins */
19+ /**
20+ * Pink Cupcake Theme initialization recipe.
21+ *
22+ * This recipe is responsible for loading the Pink Cupcake, Admin, Account and
23+ * Core sprinkle plugins. It also load the FontAwesome icons.
24+ */
1625export default {
1726 install : ( app : App ) => {
1827 app . use ( PinkCupcakeComponents )
1928 app . use ( AdminSprinkle ) // TODO : Add option to disable this or load on demand
2029 app . use ( AccountSprinkle ) // TODO : Add option to disable this or load on demand
21- app . use ( CoreSprinkle )
30+ app . use ( CoreSprinkle )
2231 app . use ( FontAwesome )
2332 }
2433}
You can’t perform that action at this time.
0 commit comments