mirror of
https://github.com/langgenius/dify.git
synced 2026-07-15 09:27:36 +08:00
18 lines
530 B
TypeScript
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
|