Add button to zero stage

This commit is contained in:
Joel Collins 2019-11-29 14:10:55 +00:00
parent 55a68738a7
commit e6057d330b

View file

@ -33,6 +33,13 @@
</div>
</div>
</div>
<button
class="uk-button uk-button-default uk-form-small uk-margin uk-width-1-1"
@click="zeroRequest()"
>
Zero coordinates
</button>
</div>
</li>
@ -182,6 +189,9 @@ export default {
moveActionUri: function() {
return `${this.$store.getters.baseUri}/api/v2/actions/stage/move`;
},
zeroActionUri: function() {
return `${this.$store.getters.baseUri}/api/v2/actions/stage/zero`;
},
positionStatusUri: function() {
return `${this.$store.getters.baseUri}/api/v2/status/stage/position`;
},
@ -314,6 +324,18 @@ export default {
}
},
zeroRequest: function() {
// Send move request
axios
.post(this.zeroActionUri)
.then(() => {
this.updatePosition(); // Update the position in text boxes
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
updatePosition: function() {
axios
.get(this.positionStatusUri)