All files / react-app/src/components/ErrorAlert index.tsx

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20        71x 5x   5x 1x                      
import * as UI from "@/components";
import { XCircleIcon } from "lucide-react";
import { ReactQueryApiError } from "shared-types";
 
export const ErrorAlert = ({ error }: { error: ReactQueryApiError }) => {
  let message = "An error has occurred";
 
  if (error?.response?.data?.message) {
    message = error.response.data.message;
  }
  return (
    // <UI.Alert alertBody={message} alertHeading="Error" variation="error" />
    <UI.Alert className="border-2" variant="destructive">
      <XCircleIcon className="w-6 h-6" />
      <UI.AlertTitle>Error</UI.AlertTitle>
      <UI.AlertDescription>{message}</UI.AlertDescription>
    </UI.Alert>
  );
};