feat(hooks): add getAgent function to useAgents hook
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user