diff --git a/packages/hoppscotch-common/src/components/collections/SaveRequest.vue b/packages/hoppscotch-common/src/components/collections/SaveRequest.vue index afcd56c8f..c0ce9765c 100644 --- a/packages/hoppscotch-common/src/components/collections/SaveRequest.vue +++ b/packages/hoppscotch-common/src/components/collections/SaveRequest.vue @@ -228,30 +228,30 @@ const saveRequestAs = async () => { if (!isHoppRESTRequest(updatedRequest)) throw new Error("requestUpdated is not a REST Request") - const collPathIndex = + const collectionPathIndex = picked.value.pickedType === "my-collection" ? picked.value.collectionIndex.toString() : picked.value.folderPath - const collHandleResult = await workspaceService.getCollectionHandle( + const collectionHandleResult = await workspaceService.getCollectionHandle( workspaceService.activeWorkspaceHandle.value, - collPathIndex + collectionPathIndex ) - if (E.isLeft(collHandleResult)) { + if (E.isLeft(collectionHandleResult)) { // INVALID_WORKSPACE_HANDLE | INVALID_COLLECTION_ID | INVALID_PATH return } - const collHandle = collHandleResult.right + const collectionHandle = collectionHandleResult.right - if (collHandle.value.type === "invalid") { + if (collectionHandle.value.type === "invalid") { // WORKSPACE_INVALIDATED return } const requestHandleResult = await workspaceService.createRESTRequest( - collHandle, + collectionHandle, updatedRequest ) @@ -299,13 +299,18 @@ const saveRequestAs = async () => { return } - // These remain here in the component + const { collectionID, providerID, requestID, workspaceID } = + requestHandle.value.data + RESTTabs.currentActiveTab.value.document = { request: updatedRequest, isDirty: false, saveContext: { originLocation: "workspace-user-collection", - requestHandle, + workspaceID, + providerID, + collectionID, + requestID, }, } diff --git a/packages/hoppscotch-common/src/components/http/Request.vue b/packages/hoppscotch-common/src/components/http/Request.vue index bc7650738..ef4dfa1c5 100644 --- a/packages/hoppscotch-common/src/components/http/Request.vue +++ b/packages/hoppscotch-common/src/components/http/Request.vue @@ -525,7 +525,19 @@ const saveRequest = async () => { return } - const { requestHandle } = saveContext + const { requestID } = saveContext + + const requestHandleResult = await newWorkspaceService.getRequestHandle( + newWorkspaceService.activeWorkspaceHandle.value, + requestID + ) + + if (E.isLeft(requestHandleResult)) { + // INVALID_COLLECTION_HANDLE | INVALID_REQUEST_ID | REQUEST_NOT_FOUND + return + } + + const requestHandle = requestHandleResult.right if (!requestHandle.value) { return diff --git a/packages/hoppscotch-common/src/components/http/TabHead.vue b/packages/hoppscotch-common/src/components/http/TabHead.vue index 65af794da..97a6dbc7e 100644 --- a/packages/hoppscotch-common/src/components/http/TabHead.vue +++ b/packages/hoppscotch-common/src/components/http/TabHead.vue @@ -1,7 +1,7 @@