mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +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 = () => {
|
||||
const qc = useQueryClient()
|
||||
|
||||
// TODO: use api
|
||||
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)) : []
|
||||
)
|
||||
return {
|
||||
updateAgent: () => {
|
||||
window.toast.info('Not implemented')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user