refactor(agents): replace useMutation with simple function in useAddAgent

The mutation logic was removed and replaced with a simple function that shows a toast message. This is a temporary solution until the actual API implementation is ready.
This commit is contained in:
icarus 2025-09-18 18:09:58 +08:00
parent ef1a035701
commit 71536d6ef5

View File

@ -1,16 +1,7 @@
import { AgentEntity } from '@renderer/types'
import { useMutation, useQueryClient } from '@tanstack/react-query'
export const useAddAgent = () => {
const qc = useQueryClient()
// TODO: use api
return useMutation({
mutationFn: async (agent: AgentEntity) => {
return agent
},
onSuccess: (added: AgentEntity) => {
qc.setQueryData<AgentEntity[]>(['agents'], (old) => (old ? [...old, added] : [added]))
return {
addAgent: () => {
window.toast.info('Not implemented')
}
})
}
}