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: auth tokens not propagating to child requests (#5154)

Mayank Jainff8a8f5e71d6
diff --git a/packages/hoppscotch-common/src/components/collections/Properties.vue b/packages/hoppscotch-common/src/components/collections/Properties.vue
index ad2def9f8..219ea567e 100644
--- a/packages/hoppscotch-common/src/components/collections/Properties.vue
+++ b/packages/hoppscotch-common/src/components/collections/Properties.vue
@@ -157,7 +157,7 @@ const toast = useToast()
const props = withDefaults(
defineProps<{
show: boolean
- loadingState: boolean
+ loadingState?: boolean
editingProperties: EditingProperties
source: "REST" | "GraphQL"
modelValue: string
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 55a774501..43fc46369 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -2796,8 +2796,13 @@ const setCollectionProperties = (newCollection: {
path: string
}) => {
const { collection, path, isRootCollection } = newCollection
+
if (!collection) return
+ // We default to using collection.id but during the callback to our application, collection.id is not being preserved.
+ // Since path is being preserved, we extract the collectionId from path instead
+ const collectionId = collection.id ?? path.split("/").pop()
+
if (collectionsType.value.type === "my-collections") {
if (isRootCollection) {
editRESTCollection(parseInt(path), collection)
@@ -2818,13 +2823,13 @@ const setCollectionProperties = (newCollection: {
)
})
toast.success(t("collection.properties_updated"))
- } else if (hasTeamWriteAccess.value && collection.id) {
+ } else if (hasTeamWriteAccess.value && collectionId) {
const data = {
auth: collection.auth,
headers: collection.headers,
}
pipe(
- updateTeamCollection(collection.id, JSON.stringify(data), undefined),
+ updateTeamCollection(collectionId, JSON.stringify(data), undefined),
TE.match(
(err: GQLError<string>) => {
toast.error(`${getErrorMessage(err)}`)