diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index 80492d0c18..80f8f22ade 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -74,9 +74,8 @@ const PluginPage = ({ (async () => { await sleep(100) if (packageId) { - const data = await fetchManifestFromMarketPlace(encodeURIComponent(packageId)) - // wait for add cors - setManifest(data) + const { data } = await fetchManifestFromMarketPlace(encodeURIComponent(packageId)) + setManifest(data.plugin) showInstallFromMarketplace() } })() diff --git a/web/service/base.ts b/web/service/base.ts index f90e3ef1b1..8efb97cff3 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -290,11 +290,15 @@ const baseFetch = ( }: IOtherOptions, ): Promise => { const options: typeof baseOptions & FetchOptionType = Object.assign({}, baseOptions, fetchOptions) + if (isMarketplaceAPI) + options.credentials = 'omit' + if (getAbortController) { const abortController = new AbortController() getAbortController(abortController) options.signal = abortController.signal } + if (isPublicAPI) { const sharedToken = globalThis.location.pathname.split('/').slice(-1)[0] const accessToken = localStorage.getItem('token') || JSON.stringify({ [sharedToken]: '' }) diff --git a/web/service/plugins.ts b/web/service/plugins.ts index 05ec73c7b1..6a2cb063fd 100644 --- a/web/service/plugins.ts +++ b/web/service/plugins.ts @@ -80,7 +80,7 @@ export const fetchManifest = async (uniqueIdentifier: string) => { } export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => { - return getMarketplace(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`) + return getMarketplace<{ data: { plugin: PluginDeclaration } }>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`) } export const installPackageFromMarketPlace = async (uniqueIdentifier: string) => {