// oxlint-disable-next-line no-restricted-imports -- this is the wrapper itself import { useToast as useBaseToast } from "@tailor-platform/app-shell"; import type { CombinedError } from "urql"; // Wraps useToast so that toast.error() accepts a CombinedError directly // and automatically extracts the human-readable message. export function useToast() { const toast = useBaseToast(); return { ...toast, // oxlint-disable-line typescript/no-misused-spread error: (error: string | CombinedError) => { const message = typeof error === "string" ? error : (error.graphQLErrors[0]?.message ?? error.message); toast.error(message); }, }; }