Fix asynchronous error

This commit is contained in:
2023-11-05 12:25:01 +07:00
parent e82fb39787
commit b0dd3abf0e
8 changed files with 127 additions and 84 deletions
@@ -3,19 +3,15 @@ import { forwardRef } from 'react';
// Styled
import { StyledBody, StyledDialog, StyledTitle } from './styled';
export interface IDialogProps<T> {
export interface IDialogProps {
title?: string;
children?: JSX.Element[] | JSX.Element;
onClose?: () => void;
reload?: boolean;
setReload?: React.Dispatch<React.SetStateAction<boolean>>;
ref?: React.MutableRefObject<HTMLDialogElement | undefined>;
data?: T | null;
isAdd?: boolean;
ref?: React.MutableRefObject<HTMLDialogElement | null>;
}
const Dialog = forwardRef((props, ref) => {
const { title, children, onClose } = props as IDialogProps<unknown>;
const Dialog = forwardRef((props: IDialogProps, ref) => {
const { title, children, onClose } = props;
return (
<StyledDialog
ref={ref as React.LegacyRef<HTMLDialogElement> | undefined}
@@ -25,6 +21,6 @@ const Dialog = forwardRef((props, ref) => {
<StyledBody>{children}</StyledBody>
</StyledDialog>
);
}) as React.FC<IDialogProps<unknown>>;
});
export default Dialog;