fix: cros promblem
This commit is contained in:
parent
6726ca102e
commit
36c01d89c9
@ -74,9 +74,8 @@ const PluginPage = ({
|
|||||||
(async () => {
|
(async () => {
|
||||||
await sleep(100)
|
await sleep(100)
|
||||||
if (packageId) {
|
if (packageId) {
|
||||||
const data = await fetchManifestFromMarketPlace(encodeURIComponent(packageId))
|
const { data } = await fetchManifestFromMarketPlace(encodeURIComponent(packageId))
|
||||||
// wait for add cors
|
setManifest(data.plugin)
|
||||||
setManifest(data)
|
|
||||||
showInstallFromMarketplace()
|
showInstallFromMarketplace()
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
@ -290,11 +290,15 @@ const baseFetch = <T>(
|
|||||||
}: IOtherOptions,
|
}: IOtherOptions,
|
||||||
): Promise<T> => {
|
): Promise<T> => {
|
||||||
const options: typeof baseOptions & FetchOptionType = Object.assign({}, baseOptions, fetchOptions)
|
const options: typeof baseOptions & FetchOptionType = Object.assign({}, baseOptions, fetchOptions)
|
||||||
|
if (isMarketplaceAPI)
|
||||||
|
options.credentials = 'omit'
|
||||||
|
|
||||||
if (getAbortController) {
|
if (getAbortController) {
|
||||||
const abortController = new AbortController()
|
const abortController = new AbortController()
|
||||||
getAbortController(abortController)
|
getAbortController(abortController)
|
||||||
options.signal = abortController.signal
|
options.signal = abortController.signal
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPublicAPI) {
|
if (isPublicAPI) {
|
||||||
const sharedToken = globalThis.location.pathname.split('/').slice(-1)[0]
|
const sharedToken = globalThis.location.pathname.split('/').slice(-1)[0]
|
||||||
const accessToken = localStorage.getItem('token') || JSON.stringify({ [sharedToken]: '' })
|
const accessToken = localStorage.getItem('token') || JSON.stringify({ [sharedToken]: '' })
|
||||||
|
@ -80,7 +80,7 @@ export const fetchManifest = async (uniqueIdentifier: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => {
|
export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => {
|
||||||
return getMarketplace<PluginDeclaration>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`)
|
return getMarketplace<{ data: { plugin: PluginDeclaration } }>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const installPackageFromMarketPlace = async (uniqueIdentifier: string) => {
|
export const installPackageFromMarketPlace = async (uniqueIdentifier: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user