Refactor vuex store actions to use async/await
The vuex store actions currently use a callback-based approach to deal with code that needs to execute after a certain action has handled. This can lead to strongly indented code that can be somewhat hard to follow.
Thankfully JavaScript introduced the async/await
as part of ES2017 which allows us to refactor these kinds of constructs into a more simple shape of:
async function foo() {
try {
const result = await this.$store.dispatch("someAction")
// ... Do something with result
} catch (e) {
// ... Handle error
}
}
As the callback approach is spread pretty far across the codebase this will probably take a while to do and an incremental adoption might be advisable.