From 4236d1179c107b011338bbd7d18fb23b3cd7468b Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Sat, 18 Sep 2021 15:11:54 +0530 Subject: [PATCH] fix: save request crashing on teams --- .../components/collections/SaveRequest.vue | 12 ++++++++---- packages/hoppscotch-app/helpers/fb/environments.ts | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/hoppscotch-app/components/collections/SaveRequest.vue b/packages/hoppscotch-app/components/collections/SaveRequest.vue index 9b304e73d..58daaea7d 100644 --- a/packages/hoppscotch-app/components/collections/SaveRequest.vue +++ b/packages/hoppscotch-app/components/collections/SaveRequest.vue @@ -37,7 +37,7 @@ :picked="picked" :save-request="true" @select="onSelect" - @update-collection="collectionsType.type = $event" + @update-collection="updateColl" @update-coll-type="onUpdateCollType" /> @@ -259,7 +259,7 @@ const saveRequestAs = async () => { requestIndex: insertionIndex, }) } else if (picked.value.pickedType === "teams-request") { - if (isHoppRESTRequest(requestUpdated)) + if (!isHoppRESTRequest(requestUpdated)) throw new Error("requestUpdated is not a REST Request") if (collectionsType.value.type !== "team-collections") @@ -277,7 +277,7 @@ const saveRequestAs = async () => { requestID: picked.value.requestID, }) } else if (picked.value.pickedType === "teams-folder") { - if (isHoppRESTRequest(requestUpdated)) + if (!isHoppRESTRequest(requestUpdated)) throw new Error("requestUpdated is not a REST Request") if (collectionsType.value.type !== "team-collections") @@ -300,7 +300,7 @@ const saveRequestAs = async () => { }) } } else if (picked.value.pickedType === "teams-collection") { - if (isHoppRESTRequest(requestUpdated)) + if (!isHoppRESTRequest(requestUpdated)) throw new Error("requestUpdated is not a REST Request") if (collectionsType.value.type !== "team-collections") @@ -347,4 +347,8 @@ const saveRequestAs = async () => { }) hideModal() } + +const updateColl = (ev: CollectionType["type"]) => { + collectionsType.value.type = ev +} diff --git a/packages/hoppscotch-app/helpers/fb/environments.ts b/packages/hoppscotch-app/helpers/fb/environments.ts index 6452430d8..a2fd0b4f4 100644 --- a/packages/hoppscotch-app/helpers/fb/environments.ts +++ b/packages/hoppscotch-app/helpers/fb/environments.ts @@ -43,8 +43,6 @@ async function writeEnvironments(environment: Environment[]) { environment, } - console.log(ev) - try { await setDoc( doc( @@ -87,7 +85,6 @@ async function writeGlobalEnvironment(variables: Environment["variables"]) { export function initEnvironments() { environments$.subscribe((envs) => { - console.log("env update") if ( currentUser$.value && settingsStore.value.syncEnvironments &&