mirror of
https://github.com/langgenius/dify.git
synced 2026-03-03 06:46:19 +08:00
Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com>
17 lines
474 B
TypeScript
17 lines
474 B
TypeScript
import { useCallback } from 'react'
|
|
import { apiPrefix } from '@/config'
|
|
import { useSelector } from '@/context/app-context'
|
|
|
|
const useGetIcon = () => {
|
|
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])
|
|
|
|
return {
|
|
getIconUrl,
|
|
}
|
|
}
|
|
|
|
export default useGetIcon
|