@afeefa/vue-app 0.0.140 → 0.0.141

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.140
1
+ 0.0.141
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.140",
3
+ "version": "0.0.141",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@ import { Component, Vue, Watch } from '@a-vue'
2
2
  import { ListAction } from '@a-vue/api-resources/ApiActions'
3
3
  import { sleep } from '@a-vue/utils/timeout'
4
4
  import { ListViewModel } from '@afeefa/api-resources-client'
5
+ import axios from 'axios'
5
6
 
6
7
  import { CurrentRouteFilterSource } from './CurrentRouteFilterSource'
7
8
  import { FilterSourceType } from './FilterSourceType'
@@ -26,6 +27,7 @@ export class ListViewMixin extends Vue {
26
27
  models_ = []
27
28
  meta_ = {}
28
29
  isLoading = false
30
+ cancelSource = null
29
31
 
30
32
  created () {
31
33
  this.init()
@@ -132,10 +134,16 @@ export class ListViewMixin extends Vue {
132
134
  this.isLoading = true
133
135
  this.$emit('update:isLoading', this.isLoading)
134
136
 
137
+ if (this.cancelSource) {
138
+ this.cancelSource.cancel()
139
+ }
140
+
141
+ this.cancelSource = axios.CancelToken.source()
135
142
  const request = this.listViewModel.getApiRequest()
136
143
 
137
144
  const {models, meta} = await ListAction
138
145
  .fromRequest(request)
146
+ .cancelSource(this.cancelSource)
139
147
  .dispatchGlobalLoadingEvents(this.events)
140
148
  .load()
141
149
 
@@ -94,7 +94,7 @@
94
94
  top
95
95
  left
96
96
  class="loadingIndicator"
97
- :isLoading="isLoading"
97
+ :isLoading="!!numLoadingRequests"
98
98
  :color="loaderColor"
99
99
  />
100
100
 
@@ -119,7 +119,7 @@
119
119
  >
120
120
  <sticky-header />
121
121
 
122
- <router-view :class="{isLoading}" />
122
+ <router-view :class="{isLoading: !!numLoadingRequests}" />
123
123
  </v-container>
124
124
 
125
125
  <sticky-footer-container />
@@ -164,7 +164,7 @@ export default class App extends Vue {
164
164
 
165
165
  drawer = true
166
166
  closeMenuIcon = mdiBackburger
167
- isLoading = false
167
+ numLoadingRequests = 0
168
168
 
169
169
  created () {
170
170
  this.$events.on(LoadingEvent.START_LOADING, this.startLoading)
@@ -200,11 +200,11 @@ export default class App extends Vue {
200
200
  }
201
201
 
202
202
  startLoading () {
203
- this.isLoading = true
203
+ this.numLoadingRequests++
204
204
  }
205
205
 
206
206
  stopLoading () {
207
- this.isLoading = false
207
+ this.numLoadingRequests--
208
208
  }
209
209
 
210
210
  toggleDrawer () {