try and fix a ts error
This commit is contained in:
@@ -5,6 +5,7 @@ import { EyeOutlined, EyeInvisibleOutlined, CheckCircleFilled, ExclamationCircle
|
|||||||
import { fetchData, UPDATE_CHAT_MESSGAE_VIZ } from "../../utils/apis";
|
import { fetchData, UPDATE_CHAT_MESSGAE_VIZ } from "../../utils/apis";
|
||||||
import { MessageType } from '../../types/chat';
|
import { MessageType } from '../../types/chat';
|
||||||
import { OUTCOME_TIMEOUT } from "../chat";
|
import { OUTCOME_TIMEOUT } from "../chat";
|
||||||
|
import { isEmptyObject } from "../../utils/format";
|
||||||
|
|
||||||
interface MessageToggleProps {
|
interface MessageToggleProps {
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
@@ -14,10 +15,14 @@ interface MessageToggleProps {
|
|||||||
|
|
||||||
|
|
||||||
export default function MessageVisiblityToggle({ isVisible, message, setMessage }: MessageToggleProps) {
|
export default function MessageVisiblityToggle({ isVisible, message, setMessage }: MessageToggleProps) {
|
||||||
|
if (!message || isEmptyObject(message)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let outcomeTimeout = null;
|
let outcomeTimeout = null;
|
||||||
const [outcome, setOutcome] = useState(0);
|
const [outcome, setOutcome] = useState(0);
|
||||||
|
|
||||||
const { id: messageId } = message;
|
const { id: messageId } = message || {};
|
||||||
|
|
||||||
const resetOutcome = () => {
|
const resetOutcome = () => {
|
||||||
outcomeTimeout = setTimeout(() => { setOutcome(0)}, OUTCOME_TIMEOUT);
|
outcomeTimeout = setTimeout(() => { setOutcome(0)}, OUTCOME_TIMEOUT);
|
||||||
|
|||||||
Reference in New Issue
Block a user