wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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