init
This commit is contained in:
27
src/mixins/InitHandler.js
Normal file
27
src/mixins/InitHandler.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import LoadingIndicator from 'common/comps/LoadingIndicator'
|
||||
|
||||
export default {
|
||||
components: { LoadingIndicator },
|
||||
|
||||
data () {
|
||||
return {
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async onInit (promise) {
|
||||
this.loading = true
|
||||
|
||||
try {
|
||||
await promise
|
||||
|
||||
this.$emit('success')
|
||||
} catch (error) {
|
||||
this.$emit('error', error)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user