Files
dify/web/app/components/plugins/install-plugin/base/use-get-icon.ts
Stephen Zhou 503d80be1d refactor(web): migrate plugins and tools app context consumers (#38533)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-08 06:26:56 +00:00

18 lines
530 B
TypeScript

import { useAtomValue } from 'jotai'
import { useCallback } from 'react'
import { API_PREFIX } from '@/config'
import { currentWorkspaceIdAtom } from '@/context/app-context-state'
const useGetIcon = () => {
const currentWorkspaceId = useAtomValue(currentWorkspaceIdAtom)
const getIconUrl = useCallback((fileName: string) => {
return `${API_PREFIX}/workspaces/current/plugin/icon?tenant_id=${currentWorkspaceId}&filename=${fileName}`
}, [currentWorkspaceId])
return {
getIconUrl,
}
}
export default useGetIcon