sdy

add if statement

......@@ -41,9 +41,13 @@ export default withRouter(({ location }) => {
roomId: roomNum,
},
});
const { text, createdAt } = messageObj;
outcomingMsg = text;
outcomingTime = createdAt;
if (!messageObj) {
toast.error("fail to create new message !, try again");
} else {
const { text, createdAt } = messageObj;
outcomingMsg = text;
outcomingTime = createdAt;
}
} catch {
toast.error("text must be not empty");
}
......