Files
DiceCloud/app/imports/ui/creature/RestButton.vue
2021-03-25 12:54:44 +02:00

55 lines
997 B
Vue

<template lang="html">
<v-btn
:loading="loading"
:disabled="context.editPermission === false"
outlined
style="width: 160px;"
@click="rest"
>
<v-icon left>
{{ type === 'shortRest' ? 'snooze' : 'bedtime' }}
</v-icon>
{{ type === 'shortRest' ? 'Short Rest' : 'Long Rest' }}
</v-btn>
</template>
<script lang="js">
import restCreature from '/imports/api/creature/restCreature.js';
export default {
inject: {
context: { default: {} }
},
props:{
type: {
type: String,
required: true,
},
creatureId: {
type: String,
required: true,
},
},
data(){return {
loading: false,
}},
methods: {
rest(){
this.loading = true;
restCreature.call({
creatureId: this.creatureId,
restType: this.type,
}, error => {
this.loading = false;
if (error){
console.error(error);
}
});
}
}
}
</script>
<style lang="css" scoped>
</style>