Added wrapper for transaction editor action clicks to handle loading state.
Build Web App / build-and-deploy (push) Successful in 17s
Details
Build Web App / build-and-deploy (push) Successful in 17s
Details
This commit is contained in:
parent
830d0b2db5
commit
710d77438f
|
|
@ -29,11 +29,13 @@ import {
|
||||||
loadEditorContextFromRoute,
|
loadEditorContextFromRoute,
|
||||||
NewTransactionEditorContext,
|
NewTransactionEditorContext,
|
||||||
TransactionEditorContext,
|
TransactionEditorContext,
|
||||||
|
type TransactionEditorAction,
|
||||||
type TransactionEditorContextBase,
|
type TransactionEditorContextBase,
|
||||||
type TransactionEditorFormFields,
|
type TransactionEditorFormFields,
|
||||||
} from './util'
|
} from './util'
|
||||||
import ButtonBar from '@/components/common/ButtonBar.vue'
|
import ButtonBar from '@/components/common/ButtonBar.vue'
|
||||||
import AppButton from '@/components/common/AppButton.vue'
|
import AppButton from '@/components/common/AppButton.vue'
|
||||||
|
import { showAlert } from '@/util/alert'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -87,6 +89,18 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
formData.value = editorContext.value.initializeFormFields(route.query)
|
formData.value = editorContext.value.initializeFormFields(route.query)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function onActionClicked(action: TransactionEditorAction) {
|
||||||
|
loading.value = true
|
||||||
|
action
|
||||||
|
.callback(formData.value, route, router)
|
||||||
|
.catch((err) => {
|
||||||
|
showAlert(err)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<AppPage :title="pageTitle">
|
<AppPage :title="pageTitle">
|
||||||
|
|
@ -240,7 +254,7 @@ onMounted(async () => {
|
||||||
v-for="action in editorContext.getActions(formData)"
|
v-for="action in editorContext.getActions(formData)"
|
||||||
:key="action.name"
|
:key="action.name"
|
||||||
:disabled="action.disabled"
|
:disabled="action.disabled"
|
||||||
@click="action.callback(formData, route, router)"
|
@click="onActionClicked(action)"
|
||||||
>
|
>
|
||||||
{{ action.name }}
|
{{ action.name }}
|
||||||
</AppButton>
|
</AppButton>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue