feat: collection level headers and authorization (#3505)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Nivedin
2023-12-13 22:43:18 +05:30
committed by GitHub
parent f3edd001d7
commit 47e009267b
95 changed files with 3221 additions and 970 deletions

View File

@@ -10,6 +10,7 @@ import { Ref, computed, effectScope, markRaw, ref, watch } from "vue"
import { getI18n } from "~/modules/i18n"
import MiniSearch from "minisearch"
import {
cascadeParentCollectionForHeaderAuth,
graphqlCollectionStore,
restCollectionStore,
} from "~/newstore/collections"
@@ -229,7 +230,7 @@ export class CollectionsSpotlightSearcherService
private getRESTFolderFromFolderPath(
folderPath: string
): HoppCollection<HoppRESTRequest> | undefined {
): HoppCollection | undefined {
try {
const folderIndicies = folderPath.split("/").map((x) => parseInt(x))
@@ -253,7 +254,7 @@ export class CollectionsSpotlightSearcherService
private getGQLFolderFromFolderPath(
folderPath: string
): HoppCollection<HoppGQLRequest> | undefined {
): HoppCollection | undefined {
try {
const folderIndicies = folderPath.split("/").map((x) => parseInt(x))
@@ -300,10 +301,15 @@ export class CollectionsSpotlightSearcherService
this.restTab.setActiveTab(possibleTab.value.id)
} else {
const req = this.getRESTFolderFromFolderPath(folderPath.join("/"))
?.requests[reqIndex]
?.requests[reqIndex] as HoppRESTRequest
if (!req) return
const { auth, headers } = cascadeParentCollectionForHeaderAuth(
folderPath.join("/"),
"rest"
)
this.restTab.createNewTab(
{
request: req,
@@ -313,6 +319,10 @@ export class CollectionsSpotlightSearcherService
folderPath: folderPath.join("/"),
requestIndex: reqIndex,
},
inheritedProperties: {
auth,
headers,
},
},
true
)
@@ -322,10 +332,14 @@ export class CollectionsSpotlightSearcherService
const reqIndex = folderPath.pop()!
const req = this.getGQLFolderFromFolderPath(folderPath.join("/"))
?.requests[reqIndex]
?.requests[reqIndex] as HoppGQLRequest
if (!req) return
const { auth, headers } = cascadeParentCollectionForHeaderAuth(
folderPath.join("/"),
"graphql"
)
this.gqlTab.createNewTab({
saveContext: {
originLocation: "user-collection",
@@ -334,6 +348,10 @@ export class CollectionsSpotlightSearcherService
},
request: req,
isDirty: false,
inheritedProperties: {
auth,
headers,
},
})
}
}