🚧 Item makes call to action button endpoint (#383)

This commit is contained in:
Alicia Sykes 2022-04-16 19:04:53 +01:00
parent ae94fdfc76
commit 79f648922a
1 changed files with 15 additions and 0 deletions

View File

@ -128,8 +128,23 @@ export default {
};
});
},
callWebHook() {
const endpoint = `${serviceEndpoints.actionButtonCall}/?url=${this.item.url}`;
axios.get(endpoint)
.then((response) => {
console.log(response);
this.$toasted.show('TODO: Show response in toast', { className: 'toast-success' });
})
.catch(() => { // Something went very wrong.
this.$toasted.show('TODO: failure msg', { className: 'toast-error' });
});
},
/* Called when an item is clicked, manages the opening of modal & resets the search field */
itemClicked(e) {
if (this.item.action) {
this.callWebHook();
return;
}
const url = this.url || this.item.url;
if (this.isEditMode) {
// If in edit mode, open settings, and don't launch app