feat: use async / await where it makes sense
This commit is contained in:
@ -93,13 +93,11 @@ export default {
|
||||
this.$nextTick(() => this.editorActive = true)
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
async create() {
|
||||
this.savedFilter.filters = this.filters
|
||||
this.savedFilterService.create(this.savedFilter)
|
||||
.then(r => {
|
||||
this.$store.dispatch('namespaces/loadNamespaces')
|
||||
this.$router.push({name: 'list.index', params: {listId: r.getListId()}})
|
||||
})
|
||||
const savedFilter = await this.savedFilterService.create(this.savedFilter)
|
||||
await this.$store.dispatch('namespaces/loadNamespaces')
|
||||
this.$router.push({name: 'list.index', params: {listId: savedFilter.getListId()}})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -24,17 +24,15 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteSavedFilter() {
|
||||
async deleteSavedFilter() {
|
||||
// We assume the listId in the route is the pseudolist
|
||||
const list = new ListModel({id: this.$route.params.listId})
|
||||
const filter = new SavedFilterModel({id: list.getSavedFilterId()})
|
||||
|
||||
this.filterService.delete(filter)
|
||||
.then(() => {
|
||||
this.$store.dispatch('namespaces/loadNamespaces')
|
||||
this.$message.success({message: this.$t('filters.delete.success')})
|
||||
this.$router.push({name: 'namespaces.index'})
|
||||
})
|
||||
await this.filterService.delete(filter)
|
||||
await this.$store.dispatch('namespaces/loadNamespaces')
|
||||
this.$message.success({message: this.$t('filters.delete.success')})
|
||||
this.$router.push({name: 'namespaces.index'})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -95,27 +95,22 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
loadSavedFilter() {
|
||||
async loadSavedFilter() {
|
||||
// We assume the listId in the route is the pseudolist
|
||||
const list = new ListModel({id: this.$route.params.listId})
|
||||
|
||||
this.filter = new SavedFilterModel({id: list.getSavedFilterId()})
|
||||
this.filterService.get(this.filter)
|
||||
.then(r => {
|
||||
this.filter = r
|
||||
this.filters = objectToSnakeCase(this.filter.filters)
|
||||
})
|
||||
this.filter = await this.filterService.get(this.filter)
|
||||
this.filters = objectToSnakeCase(this.filter.filters)
|
||||
},
|
||||
save() {
|
||||
async save() {
|
||||
this.filter.filters = this.filters
|
||||
this.filterService.update(this.filter)
|
||||
.then(r => {
|
||||
this.$store.dispatch('namespaces/loadNamespaces')
|
||||
this.$message.success({message: this.$t('filters.edit.success')})
|
||||
this.filter = r
|
||||
this.filters = objectToSnakeCase(this.filter.filters)
|
||||
this.$router.back()
|
||||
})
|
||||
const filter = await this.filterService.update(this.filter)
|
||||
await this.$store.dispatch('namespaces/loadNamespaces')
|
||||
this.$message.success({message: this.$t('filters.edit.success')})
|
||||
this.filter = filter
|
||||
this.filters = objectToSnakeCase(this.filter.filters)
|
||||
this.$router.back()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user