dify/web/app/components/plugins/install-plugin/base/use-get-icon.ts

17 lines
474 B
TypeScript
Raw Normal View History

2024-11-13 11:33:39 +08:00
import { useCallback } from 'react'
2024-10-29 11:57:21 +08:00
import { apiPrefix } from '@/config'
2024-11-13 11:33:39 +08:00
import { useSelector } from '@/context/app-context'
2024-10-29 11:47:14 +08:00
const useGetIcon = () => {
2024-11-13 11:33:39 +08:00
const currentWorkspace = useSelector(s => s.currentWorkspace)
const getIconUrl = useCallback((fileName: string) => {
return `${apiPrefix}/workspaces/current/plugin/icon?tenant_id=${currentWorkspace.id}&filename=${fileName}`
}, [currentWorkspace.id])
2024-10-29 11:47:14 +08:00
return {
2024-10-29 11:57:21 +08:00
getIconUrl,
2024-10-29 11:47:14 +08:00
}
}
export default useGetIcon