fix(app): refresh directory MCP status (#31194)
This commit is contained in:
parent
f24049736e
commit
a29deb1ee9
7 changed files with 101 additions and 58 deletions
19
packages/app/src/context/mcp.ts
Normal file
19
packages/app/src/context/mcp.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { useMutation } from "@tanstack/solid-query"
|
||||
import { useLanguage } from "@/context/language"
|
||||
import { useSync } from "@/context/sync"
|
||||
import { showToast } from "@/utils/toast"
|
||||
|
||||
export function useMcpToggle() {
|
||||
const sync = useSync()
|
||||
const language = useLanguage()
|
||||
|
||||
return useMutation(() => ({
|
||||
mutationFn: sync.mcp.toggle,
|
||||
onError: (error) =>
|
||||
showToast({
|
||||
variant: "error",
|
||||
title: language.t("common.requestFailed"),
|
||||
description: error instanceof Error ? error.message : String(error),
|
||||
}),
|
||||
}))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue