mirror of
https://github.com/Lissy93/web-check.git
synced 2025-08-15 07:12:39 +02:00
fix: handle undefined robots data and improve object destructuring in RobotsTxt component
This commit is contained in:
@ -11,15 +11,17 @@ const cardStyles = `
|
||||
`;
|
||||
|
||||
const RobotsTxtCard = ( props: { data: { robots: RowProps[]}, title: string, actionButtons: any}): JSX.Element => {
|
||||
const robots = props.data;
|
||||
const { data } = props;
|
||||
const robots = data?.robots || [];
|
||||
|
||||
return (
|
||||
<Card heading={props.title} actionButtons={props.actionButtons} styles={cardStyles}>
|
||||
<div className="content">
|
||||
{
|
||||
robots.robots.length === 0 && <p>No crawl rules found.</p>
|
||||
robots.length === 0 && <p>No crawl rules found.</p>
|
||||
}
|
||||
{
|
||||
robots.robots.map((row: RowProps, index: number) => {
|
||||
robots.map((row: RowProps, index: number) => {
|
||||
return (
|
||||
<Row key={`${row.lbl}-${index}`} lbl={row.lbl} val={row.val} />
|
||||
)
|
||||
|
Reference in New Issue
Block a user