@afeefa/vue-app 0.0.107 → 0.0.109
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.109
|
package/package.json
CHANGED
package/src-admin/bootstrap.js
CHANGED
@@ -2,6 +2,7 @@ import './config/event-bus'
|
|
2
2
|
import './config/components'
|
3
3
|
import './directives'
|
4
4
|
|
5
|
+
import { authPlugin } from '@a-admin/plugins/AuthPlugin'
|
5
6
|
import { translationPlugin } from '@a-admin/plugins/translation/TranslationPlugin'
|
6
7
|
import { apiResourcesPlugin } from '@a-vue/plugins/api-resources/ApiResourcesPlugin'
|
7
8
|
import { hasOptionsPlugin } from '@a-vue/plugins/has-options/HasOptionsPlugin'
|
@@ -19,12 +20,18 @@ Vue.use(translationPlugin)
|
|
19
20
|
Vue.config.productionTip = false
|
20
21
|
|
21
22
|
export async function bootstrap ({ apis, models, routing, authService, getTranslations, app, components }) {
|
22
|
-
apiResourcesPlugin.register(models, apis)
|
23
|
-
|
24
23
|
appConfig.authService = authService
|
25
24
|
appConfig.app = app
|
26
25
|
appConfig.components = components
|
27
26
|
|
27
|
+
if (authService) {
|
28
|
+
const authenticated = await authService.authenticate()
|
29
|
+
if (!authenticated) {
|
30
|
+
return
|
31
|
+
}
|
32
|
+
Vue.use(authPlugin)
|
33
|
+
}
|
34
|
+
|
28
35
|
const splash = new Vue({
|
29
36
|
vuetify,
|
30
37
|
el: '#splash',
|
@@ -34,8 +41,15 @@ export async function bootstrap ({ apis, models, routing, authService, getTransl
|
|
34
41
|
}
|
35
42
|
})
|
36
43
|
|
44
|
+
if (authService) {
|
45
|
+
await authService.init()
|
46
|
+
}
|
47
|
+
|
48
|
+
apiResourcesPlugin.register(models, apis)
|
49
|
+
|
37
50
|
routing(routeConfigPlugin)
|
38
51
|
const router = await routeConfigPlugin.getRouter()
|
52
|
+
|
39
53
|
await apiResourcesPlugin.schemasLoaded()
|
40
54
|
|
41
55
|
if (getTranslations) {
|
@@ -43,10 +57,6 @@ export async function bootstrap ({ apis, models, routing, authService, getTransl
|
|
43
57
|
translationPlugin.setTranslations(translations.models)
|
44
58
|
}
|
45
59
|
|
46
|
-
if (authService) {
|
47
|
-
authService.initApp(router)
|
48
|
-
}
|
49
|
-
|
50
60
|
// routeConfigPlugin.dumpRoutes()
|
51
61
|
// routeConfigPlugin.dumbBreadcrumbs()
|
52
62
|
|
@@ -143,16 +143,10 @@ import '../styles.scss'
|
|
143
143
|
export default class App extends Vue {
|
144
144
|
drawer = true
|
145
145
|
isLoading = false
|
146
|
-
account = null
|
147
146
|
|
148
147
|
created () {
|
149
148
|
this.$events.on(LoadingEvent.START_LOADING, this.startLoading)
|
150
149
|
this.$events.on(LoadingEvent.STOP_LOADING, this.stopLoading)
|
151
|
-
|
152
|
-
if (this.hasAuthService) {
|
153
|
-
this.account = appConfig.authService.getAccount()
|
154
|
-
}
|
155
|
-
|
156
150
|
this.$emit('appLoaded')
|
157
151
|
}
|
158
152
|
|
@@ -164,6 +158,13 @@ export default class App extends Vue {
|
|
164
158
|
return appConfig.app.logo
|
165
159
|
}
|
166
160
|
|
161
|
+
get account () {
|
162
|
+
if (this.hasAuthService) {
|
163
|
+
return this.$auth.account
|
164
|
+
}
|
165
|
+
return null
|
166
|
+
}
|
167
|
+
|
167
168
|
get title () {
|
168
169
|
return appConfig.app.title
|
169
170
|
}
|
@@ -189,11 +190,11 @@ export default class App extends Vue {
|
|
189
190
|
}
|
190
191
|
|
191
192
|
get hasAuthService () {
|
192
|
-
return !!
|
193
|
+
return !!this.$auth
|
193
194
|
}
|
194
195
|
|
195
196
|
logout () {
|
196
|
-
|
197
|
+
this.$auth.logout()
|
197
198
|
}
|
198
199
|
}
|
199
200
|
</script>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Component,
|
1
|
+
import { Component, Vue, Watch } from '@a-vue'
|
2
2
|
|
3
3
|
Component.registerHooks([
|
4
4
|
'beforeRouteEnter',
|
@@ -50,7 +50,7 @@ export class DataRouteMixin extends Vue {
|
|
50
50
|
|
51
51
|
// watches (if defined) route idKey and reloads data if changed
|
52
52
|
@Watch('drm_id')
|
53
|
-
async
|
53
|
+
async drm_routeParamsChanged () {
|
54
54
|
if (routerHookCalled) {
|
55
55
|
return
|
56
56
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { appConfig } from '../config/AppConfig'
|
2
|
+
|
3
|
+
class AuthPlugin {
|
4
|
+
install (Vue) {
|
5
|
+
const authService = appConfig.authService
|
6
|
+
const $auth = {
|
7
|
+
account: authService.getCurrentAccount(),
|
8
|
+
|
9
|
+
hasRight: name => authService.currentAccountHasRight(name),
|
10
|
+
|
11
|
+
hasRole: name => authService.currentAccountHasRole(name),
|
12
|
+
|
13
|
+
logout: () => authService.forwardToLogoutEndpoint()
|
14
|
+
}
|
15
|
+
|
16
|
+
Vue.prototype.$auth = $auth
|
17
|
+
Vue.$auth = $auth
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
export const authPlugin = new AuthPlugin()
|