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] [client, mutate, t]
) )
const getAgent = useCallback(
(id: string) => {
return data?.agents.find((agent) => agent.id === id)
},
[data?.agents]
)
return { return {
agents: data?.agents ?? [], agents: data?.agents ?? [],
error, error,
isLoading, isLoading,
addAgent, addAgent,
updateAgent, updateAgent,
deleteAgent deleteAgent,
getAgent
} }
} }