Refactored actions, 'cast a spell' task now works

This commit is contained in:
Thaum Rystra
2024-10-28 12:28:36 +02:00
parent 804c5f3aee
commit 8f8c9c28aa
39 changed files with 423 additions and 399 deletions

View File

@@ -23,6 +23,7 @@
<script lang="js">
import doAction from '/imports/client/ui/creature/actions/doAction';
import PropertyIcon from '/imports/client/ui/properties/shared/PropertyIcon.vue';
import { snackbar } from '/imports/client/ui/components/snackbars/SnackbarQueue';
export default {
components: {
@@ -39,10 +40,22 @@ export default {
},
data(){return {
hovering: false,
loading: false,
}},
methods: {
doAction() {
doAction(this.model, this.$store, `event-btn-${this.model._id}`);
async doAction() {
this.loading = true;
doAction({
propId: this.model._id,
creatureId: this.model.root.id,
$store: this.$store,
elementId: `event-btn-${this.model._id}`,
}).catch(error => {
snackbar({ text: error.reason || error.message || error.toString() });
console.error(error);
}).finally(() => {
this.loading = false;
});
},
}
}