mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-25 10:28:23 +03:00
15 lines
469 B
TypeScript
15 lines
469 B
TypeScript
import { isInvalidArgumentError, ProblemDetailsError } from '../utils/services/types';
|
|
|
|
interface ShlinkApiErrorProps {
|
|
errorData?: ProblemDetailsError;
|
|
fallbackMessage?: string;
|
|
}
|
|
|
|
export const ShlinkApiError = ({ errorData, fallbackMessage }: ShlinkApiErrorProps) => (
|
|
<>
|
|
{errorData?.detail ?? fallbackMessage}
|
|
{isInvalidArgumentError(errorData) &&
|
|
<p className="mb-0">Invalid elements: [{errorData.invalidElements.join(', ')}]</p>
|
|
}
|
|
</>
|
|
);
|