Skip to content

The open alternative to Salesforce, designed for AI.

420 B
Raw Blame
import { isGraphqlErrorOfType } from '~/utils/is-graphql-error-of-type.util';
import { isDefined } from 'twenty-shared/utils';

export const isChatAccessDenied = (
  errors:
    | readonly { extensions?: Readonly<Record<string, unknown>> }[]
    | undefined,
) =>
  isDefined(errors) &&
  errors.some(
    (error) =>
      isGraphqlErrorOfType(error, 'NOT_FOUND') ||
      isGraphqlErrorOfType(error, 'FORBIDDEN'),
  );