JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "show-http-error-toast.ts"

Full Path: /home/markqprx/iniasli.pro/client/utils/http/show-http-error-toast.ts
File size: 589 bytes
MIME-type: text/plain
Charset: utf-8

import {toast} from '../../ui/toast/toast';
import {getAxiosErrorMessage} from './get-axios-error-message';
import {message} from '../../i18n/message';
import {ToastOptions} from '@common/ui/toast/toast-store';

const defaultErrorMessage = message('There was an issue. Please try again.');

export function showHttpErrorToast(
  err: unknown,
  defaultMessage = defaultErrorMessage,
  field?: string | null,
  toastOptions?: ToastOptions
) {
  toast.danger(getAxiosErrorMessage(err, field) || defaultMessage, {
    action: (err as any).response?.data?.action,
    ...toastOptions,
  });
}