import { Stack } from '@keystone-ui/core'
import { Notice } from '@keystone-ui/notice'
import type { GraphQLFormattedError } from 'graphql'
import React from 'react'
type GraphQLErrorNoticeProps = {
networkError: Error | null | undefined
errors: readonly GraphQLFormattedError[] | undefined
}
export function GraphQLErrorNotice ({ errors, networkError }: GraphQLErrorNoticeProps) {
if (networkError) {
return (
{networkError.message}
)
}
if (errors?.length) {
return (
{errors.map((err, idx) => (
{err.message}
))}
)
}
return null
}