Skip to content

Commit

Permalink
🚧 Item makes call to action button endpoint (gchq#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Apr 16, 2022
1 parent ae94fdf commit 79f6489
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/mixins/ItemMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 79f6489

Please sign in to comment.