feat(hooks): add getAgent function to useAgents hook

This commit is contained in:
icarus 2025-09-18 21:34:25 +08:00
parent 3b0995c8ef
commit 3b5b1986e6

View File

@ -55,12 +55,20 @@ export const useAgents = () => {
[client, mutate, t]
)
const getAgent = useCallback(
(id: string) => {
return data?.agents.find((agent) => agent.id === id)
},
[data?.agents]
)
return {
agents: data?.agents ?? [],
error,
isLoading,
addAgent,
updateAgent,
deleteAgent
deleteAgent,
getAgent
}
}