Skip to content

Commit

Permalink
wrap state handling in onClose
Browse files Browse the repository at this point in the history
  • Loading branch information
gsfk committed Dec 11, 2023
1 parent 2265c40 commit 43d6756
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/js/components/Beacon/BeaconErrorMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, { Dispatch, SetStateAction } from 'react';
import { Alert } from 'antd';

const BeaconErrorMessage = ({ message, setErrorAlertClosed }: BeaconErrorMessageProps) => {
const BeaconErrorMessage = ({ message, onClose }: BeaconErrorMessageProps) => {
return (
<div style={{ paddingTop: '16px' }}>
<Alert type={'error'} message={message} onClose={() => setErrorAlertClosed(true)} closable showIcon />
<Alert type={'error'} message={message} onClose={onClose} closable showIcon />
</div>
);
};

export interface BeaconErrorMessageProps {
message: string;
setErrorAlertClosed: Dispatch<SetStateAction<boolean>>;
onClose: () => void;
}

export default BeaconErrorMessage;
2 changes: 1 addition & 1 deletion src/js/components/Beacon/BeaconQueryUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ const BeaconQueryUi = () => {
{showError && (
<BeaconErrorMessage
message={`${td('Beacon error')}: ${errorMessage}`}
setErrorAlertClosed={setErrorAlertClosed}
onClose={() => setErrorAlertClosed(true)}
/>
)}
<div style={BUTTON_AREA_STYLE}>
Expand Down

0 comments on commit 43d6756

Please sign in to comment.