mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-26 19:56:41 +00:00
11 lines
562 B
TypeScript
11 lines
562 B
TypeScript
import { AxiosError } from 'axios';
|
|
import { InvalidArgumentError, InvalidShortUrlDeletion, ProblemDetailsError } from '../types';
|
|
|
|
export const parseApiError = (e: AxiosError<ProblemDetailsError>) => e.response?.data;
|
|
|
|
export const isInvalidArgumentError = (error?: ProblemDetailsError): error is InvalidArgumentError =>
|
|
error?.type === 'INVALID_ARGUMENT';
|
|
|
|
export const isInvalidDeletionError = (error?: ProblemDetailsError): error is InvalidShortUrlDeletion =>
|
|
error?.type === 'INVALID_SHORTCODE_DELETION' || error?.type === 'INVALID_SHORT_URL_DELETION';
|