mcp.ts 556 B

12345678910111213141516171819
  1. import { useMutation } from "@tanstack/solid-query"
  2. import { useLanguage } from "@/context/language"
  3. import { useSync } from "@/context/sync"
  4. import { showToast } from "@/utils/toast"
  5. export function useMcpToggle() {
  6. const sync = useSync()
  7. const language = useLanguage()
  8. return useMutation(() => ({
  9. mutationFn: sync().mcp.toggle,
  10. onError: (error) =>
  11. showToast({
  12. variant: "error",
  13. title: language.t("common.requestFailed"),
  14. description: error instanceof Error ? error.message : String(error),
  15. }),
  16. }))
  17. }