mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-12 19:27:29 +03:00
16 lines
486 B
TypeScript
16 lines
486 B
TypeScript
import { ProblemDetailsError } from './types';
|
|
import { isInvalidArgumentError } from './utils';
|
|
|
|
export 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>
|
|
}
|
|
</>
|
|
);
|