diff --git a/packages/hoppscotch-app/components/collections/index.vue b/packages/hoppscotch-app/components/collections/index.vue
index 4318ffe4f..2c9fefd0b 100644
--- a/packages/hoppscotch-app/components/collections/index.vue
+++ b/packages/hoppscotch-app/components/collections/index.vue
@@ -647,11 +647,26 @@ export default defineComponent({
})
}
},
- duplicateRequest({ folderPath, request }) {
- saveRESTRequestAs(folderPath, {
- ...cloneDeep(request),
- name: `${request.name} - ${this.$t("action.duplicate")}`,
- })
+ duplicateRequest({ folderPath, request, collectionID }) {
+ if (this.collectionsType.type === "team-collections") {
+ const newReq = {
+ ...cloneDeep(request),
+ name: `${request.name} - ${this.$t("action.duplicate")}`,
+ }
+
+ teamUtils.saveRequestAsTeams(
+ this.$apollo,
+ JSON.stringify(newReq),
+ `${request.name} - ${this.$t("action.duplicate")}`,
+ this.collectionsType.selectedTeam.id,
+ collectionID
+ )
+ } else if (this.collectionsType.type === "my-collections") {
+ saveRESTRequestAs(folderPath, {
+ ...cloneDeep(request),
+ name: `${request.name} - ${this.$t("action.duplicate")}`,
+ })
+ }
},
},
})
diff --git a/packages/hoppscotch-app/components/collections/teams/Collection.vue b/packages/hoppscotch-app/components/collections/teams/Collection.vue
index 20e9febc5..65f6152dc 100644
--- a/packages/hoppscotch-app/components/collections/teams/Collection.vue
+++ b/packages/hoppscotch-app/components/collections/teams/Collection.vue
@@ -152,6 +152,7 @@
@select="$emit('select', $event)"
@expand-collection="expandCollection"
@remove-request="removeRequest"
+ @duplicate-request="$emit('duplicate-request', $event)"
/>