From be61b6282576df85b0980120762b2e5e58be9c93 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 3 Jul 2023 11:23:02 +0530 Subject: [PATCH] feat: add clear history action --- packages/hoppscotch-common/src/components/history/index.vue | 5 +++++ packages/hoppscotch-common/src/helpers/actions.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/hoppscotch-common/src/components/history/index.vue b/packages/hoppscotch-common/src/components/history/index.vue index f29d4d3ef..91c12b968 100644 --- a/packages/hoppscotch-common/src/components/history/index.vue +++ b/packages/hoppscotch-common/src/components/history/index.vue @@ -176,6 +176,7 @@ import { import HistoryRestCard from "./rest/Card.vue" import HistoryGraphqlCard from "./graphql/Card.vue" import { createNewTab } from "~/helpers/rest/tab" +import { defineActionHandler } from "~/helpers/actions" type HistoryEntry = GQLHistoryEntry | RESTHistoryEntry @@ -329,4 +330,8 @@ const toggleStar = (entry: HistoryEntry) => { toggleRESTHistoryEntryStar(entry as RESTHistoryEntry) else toggleGraphqlHistoryEntryStar(entry as GQLHistoryEntry) } + +defineActionHandler("history.clear", () => { + confirmRemove.value = true +}) diff --git a/packages/hoppscotch-common/src/helpers/actions.ts b/packages/hoppscotch-common/src/helpers/actions.ts index f18c5d4da..33bae0668 100644 --- a/packages/hoppscotch-common/src/helpers/actions.ts +++ b/packages/hoppscotch-common/src/helpers/actions.ts @@ -38,6 +38,7 @@ export type HoppAction = | "response.file.download" // Download response as file | "response.copy" // Copy response to clipboard | "modals.login.toggle" // Login to Hoppscotch + | "history.clear" // Clear REST History /** * Defines the arguments, if present for a given type that is required to be passed on