mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-29 14:31:35 +08:00
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:
parent
ef1a035701
commit
71536d6ef5
@ -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')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user