Skip to content

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

fix: graphql save request emit payload (#2913)

Nivedinf676f94278ab
diff --git a/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue b/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue
index 207fc6041..471ccb5cd 100644
--- a/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue
+++ b/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue
@@ -225,6 +225,7 @@ import {
removeGraphqlCollection,
moveGraphqlRequest,
} from "~/newstore/collections"
+import { Picked } from "~/helpers/types/HoppPicked"
const props = defineProps({
picked: { type: Object, default: null },
@@ -241,7 +242,7 @@ const t = useI18n()
// TODO: improve types plz
const emit = defineEmits<{
- (e: "select", i: { picked: any }): void
+ (e: "select", i: Picked | null): void
(e: "edit-request", i: any): void
(e: "duplicate-request", i: any): void
(e: "add-request", i: any): void
@@ -277,10 +278,8 @@ const collectionIcon = computed(() => {
const pick = () => {
emit("select", {
- picked: {
- pickedType: "gql-my-collection",
- collectionIndex: props.collectionIndex,
- },
+ pickedType: "gql-my-collection",
+ collectionIndex: props.collectionIndex,
})
}
@@ -298,7 +297,7 @@ const removeCollection = () => {
props.picked?.pickedType === "gql-my-collection" &&
props.picked?.collectionIndex === props.collectionIndex
) {
- emit("select", { picked: null })
+ emit("select", null)
}
removeGraphqlCollection(props.collectionIndex)
toast.success(`${t("state.deleted")}`)
diff --git a/packages/hoppscotch-common/src/components/collections/graphql/Request.vue b/packages/hoppscotch-common/src/components/collections/graphql/Request.vue
index e558c6f5e..ac16a9c72 100644
--- a/packages/hoppscotch-common/src/components/collections/graphql/Request.vue
+++ b/packages/hoppscotch-common/src/components/collections/graphql/Request.vue
@@ -169,11 +169,9 @@ const isSelected = computed(
const pick = () => {
emit("select", {
- picked: {
- pickedType: "gql-my-request",
- folderPath: props.folderPath,
- requestIndex: props.requestIndex,
- },
+ pickedType: "gql-my-request",
+ folderPath: props.folderPath,
+ requestIndex: props.requestIndex,
})
}
@@ -213,7 +211,7 @@ const removeRequest = () => {
props.picked.folderPath === props.folderPath &&
props.picked.requestIndex === props.requestIndex
) {
- emit("select", { picked: null })
+ emit("select", null)
}
removeGraphqlRequest(props.folderPath, props.requestIndex)