import type { ApolloError } from "@apollo/client"
import { useEffect } from "react"
import toast from "react-hot-toast"

export function useShowApolloErrorToast(error?: ApolloError) {
  useEffect(() => {
    if (error) {
      toast.error(error.message)
    }
  }, [error])
}

export function showErrorToast(error: ApolloError) {
  toast.error(error.message)
}
