@afeefa/vue-app 0.0.105 → 0.0.107

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.
@@ -1 +1 @@
1
- 0.0.105
1
+ 0.0.107
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.105",
3
+ "version": "0.0.107",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,3 +1,6 @@
1
+ import { AlertEvent } from '@a-vue/events'
2
+ import { eventBus } from '@a-vue/plugins/event-bus/EventBus'
3
+
1
4
  import { ApiAction } from './ApiAction'
2
5
 
3
6
  export class DeleteAction extends ApiAction {
@@ -22,4 +25,12 @@ export class DeleteAction extends ApiAction {
22
25
  processResult () {
23
26
  return true
24
27
  }
28
+
29
+ processError (result) {
30
+ eventBus.dispatch(new AlertEvent(AlertEvent.ERROR, {
31
+ headline: 'Die Daten konnten nicht gelöscht werden.',
32
+ message: result.message,
33
+ detail: result.detail
34
+ }))
35
+ }
25
36
  }
@@ -1,4 +1,4 @@
1
- import { Component, Vue } from '@a-vue'
1
+ import { Component, Watch, Vue } from '@a-vue'
2
2
 
3
3
  Component.registerHooks([
4
4
  'beforeRouteEnter',
@@ -36,39 +36,36 @@ function load (route) {
36
36
 
37
37
  @Component
38
38
  export class DataRouteMixin extends Vue {
39
- drm_isLoaded = false
40
-
41
39
  async beforeRouteEnter (to, from, next) {
42
40
  routerHookCalled = true
43
41
  const result = await load(to)
44
-
45
42
  next(vm => {
46
43
  if (result !== false) {
47
44
  vm.drm_onLoad(result)
48
- vm.drm_isLoaded = true
49
45
  }
50
46
  routerHookCalled = false
51
47
  })
52
48
  }
53
49
 
54
- /**
55
- * triggered both, if route name or route params change
56
- @Watch('$route.params')
57
- async routeParamsChanged () {
58
- if (routerHookCalled) {
59
- return
60
- }
61
50
 
62
- if (!this.drm_isLoaded) {
63
- const result = await load(this.$route)
51
+ // watches (if defined) route idKey and reloads data if changed
52
+ @Watch('drm_id')
53
+ async routeParamsChanged () {
54
+ if (routerHookCalled) {
55
+ return
56
+ }
57
+
58
+ const result = await load(this.$route)
59
+
60
+ if (result !== false) {
61
+ this.drm_onLoad(result)
62
+ }
63
+ }
64
64
 
65
- if (result !== false) {
66
- this.drm_onLoad(result)
67
- this.drm_isLoaded = true
68
- }
69
- }
70
- }
71
- */
65
+ // return route config idKey
66
+ get drm_id () {
67
+ return this.$route.params[this.$routeDefinition.idKey]
68
+ }
72
69
 
73
70
  drm_onLoad (result) {
74
71
  onLoadCallback(this, result)