All files / app/src/entities/accounting-object-import/lib handle-delete-import-error.ts

16.66% Statements 2/12
100% Branches 0/0
0% Functions 0/1
16.66% Lines 2/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 171x         1x                      
import { AxiosError } from 'axios'
import { HydraErrorWithImportErrors } from './types'
import { notify } from '@/shared/lib'
import { TFunction } from '@tmk/ui-kit'
 
export const handleDeleteImportError = (data: AxiosError<HydraErrorWithImportErrors>, t: TFunction) => {
  const violations = data.response?.data.violations
  if (violations?.some(violation => violation.message == t('Error_status_for_delete'))) {
    return notify(t('Import_delete_failed_waiting'), {
      status: 'error',
    })
  }
  return notify(t('Delete failed'), {
    status: 'error',
  })
}