diff --git a/web/app/components/plugins/install-plugin/base/use-get-icon.ts b/web/app/components/plugins/install-plugin/base/use-get-icon.ts index 210634b4a7..ea7f8e36b9 100644 --- a/web/app/components/plugins/install-plugin/base/use-get-icon.ts +++ b/web/app/components/plugins/install-plugin/base/use-get-icon.ts @@ -1,10 +1,10 @@ -import { fetchIcon } from '@/service/plugins' +import { apiPrefix } from '@/config' import { fetchWorkspaces } from '@/service/common' let tenantId: string | null | undefined = null const useGetIcon = () => { - const getIcon = async (fileName: string) => { + const getIconUrl = async (fileName: string) => { if (!tenantId) { const { workspaces } = await fetchWorkspaces({ url: '/workspaces', @@ -12,12 +12,11 @@ const useGetIcon = () => { }) tenantId = workspaces.find(v => v.current)?.id } - const res = await fetchIcon(tenantId!, fileName) - return res + return `${apiPrefix}/workspaces/current/plugin/icon?tenant_id=${tenantId}&filename=${fileName}` } return { - getIcon, + getIconUrl, } } diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx index d9dd879fa4..c93cc81291 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx @@ -39,7 +39,7 @@ const InstallFromLocalPackage: React.FC = ({ return t(`${i18nPrefix}.installPlugin`) }, [step]) - const { getIcon } = useGetIcon() + const { getIconUrl } = useGetIcon() const handleUploaded = useCallback(async (result: { uniqueIdentifier: string @@ -49,8 +49,7 @@ const InstallFromLocalPackage: React.FC = ({ manifest, uniqueIdentifier, } = result - // TODO: wait for api to fix result - const icon: any = await getIcon(manifest!.icon) + const icon = await getIconUrl(manifest!.icon) setUniqueIdentifier(uniqueIdentifier) setManifest({ ...manifest,