From 362ab730264894730abd478b720a97cf3d4fa3ff Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Thu, 22 Aug 2019 19:09:03 +0530 Subject: [PATCH] History is sorted from latest to oldest --- script.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 61a003c34..6b60cd518 100644 --- a/script.js +++ b/script.js @@ -87,12 +87,15 @@ const app = new Vue({ }, sendRequest() { const n = new Date().toLocaleTimeString() - this.history.push({ + + // Latest requests should be placed on top + this.history = [{ time: n, method: this.method, url: this.url, path: this.path - }) + }, ...this.history] + window.localStorage.setItem("history", JSON.stringify(this.history)) if (this.$refs.response.classList.contains('hidden')) { this.$refs.response.classList.toggle('hidden')