Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Added a Clear History button

Andrew Bastinb8f9f236845f
diff --git a/index.html b/index.html
index c015163cd..ffbb3d116 100644
--- a/index.html
+++ b/index.html
@@ -107,6 +107,9 @@
<fieldset class="history hidden">
<legend v-on:click="collapse">History ↕</legend>
<div class="collapsible">
+ <ul>
+ <li><button v-on:click="clearHistory">Clear History</button></li>
+ </ul>
<ul v-for="entry in history">
<li>
<label for="time">Time</label>
diff --git a/script.js b/script.js
index ea38ac3f1..705ec9f02 100644
--- a/script.js
+++ b/script.js
@@ -79,6 +79,12 @@ const app = new Vue({
this.history.splice(this.history.indexOf(entry), 1)
window.localStorage.setItem('history', JSON.stringify(this.history))
},
+
+ clearHistory() {
+ this.history = []
+ window.localStorage.setItem('history', JSON.stringify(this.history))
+ },
+
useHistory({
method,
url,