Files
BTCPayServerPlugins/Plugins/BTCPayServer.Plugins.AOPP/Resources/js/aoppComponent.js
2023-01-16 13:13:18 +01:00

37 lines
1.3 KiB
JavaScript

Vue.component("AOPP", {
props: ["srvModel"],
methods: {
onaoppChange: function(){
this.aoppAddressInputDirty = true;
this.aoppAddressInputInvalid = false;
},
onSubmit : function(){
var self = this;
if (this.aoppAddressInput && this.aoppAddressInput.startsWith("aopp:?")) {
this.aoppAddressFormSubmitting = true;
// Push the email to a server, once the reception is confirmed move on
$.ajax({
url: "/plugins/"+this.srvModel.storeId+"/AOPP/" +this.srvModel.invoiceId,
type: "POST",
data: JSON.stringify({ aopp: this.aoppAddressInput }),
contentType: "application/json; charset=utf-8"
})
.done(function () {
}).always(function () {
self.aoppAddressFormSubmitting = false;
});
} else {
this.aoppAddressInputInvalid = true;
}
}
},
data: function () {
return {
aoppAddressInput: "",
aoppAddressInputDirty: false,
aoppAddressInputInvalid: false,
aoppAddressFormSubmitting: false
}
}
});