mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 06:19:05 +08:00
refactor(agents): replace unimplemented mutation with simple function
Replace the placeholder mutation implementation in useUpdateAgent hook with a simpler function that shows a toast notification. This removes the unnecessary query client usage for an unimplemented feature.
This commit is contained in:
parent
71536d6ef5
commit
21ce139df0
@ -1,18 +1,7 @@
|
|||||||
import { AgentEntity } from '@renderer/types'
|
|
||||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
||||||
|
|
||||||
export const useUpdateAgent = () => {
|
export const useUpdateAgent = () => {
|
||||||
const qc = useQueryClient()
|
return {
|
||||||
|
updateAgent: () => {
|
||||||
// TODO: use api
|
window.toast.info('Not implemented')
|
||||||
return useMutation({
|
|
||||||
mutationFn: async (agentUpdate: Partial<AgentEntity> & { id: string }) => {
|
|
||||||
throw new Error(`useUpdateAgent mutationFn not implemented for agent ${agentUpdate.id}`)
|
|
||||||
},
|
|
||||||
onSuccess: (updated: AgentEntity) => {
|
|
||||||
qc.setQueryData<AgentEntity[]>(['todos'], (old) =>
|
|
||||||
old ? old.map((t) => (t.id === updated.id ? updated : t)) : []
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user