Added undo button for undoing removing headers

This commit is contained in:
Andrew Bastin
2019-11-26 22:46:33 -05:00
parent 33cbc9b525
commit b67de81616

View File

@@ -604,10 +604,22 @@ export default {
return false; return false;
}, },
removeRequestHeader(index) { removeRequestHeader(index) {
// .slice() is used so we get a separate array, rather than just a reference
const oldHeaders = this.headers.slice();
this.$store.commit("removeGQLHeader", index); this.$store.commit("removeGQLHeader", index);
this.$toast.error("Deleted", { this.$toast.error("Deleted", {
icon: "delete" icon: "delete",
action: {
text: "Undo",
duration: 4000,
onClick: (e, toastObject) => {
this.headers = oldHeaders;
toastObject.remove();
}
}
}); });
console.log(oldHeaders);
} }
} }
}; };