sdy

add if statement

...@@ -41,9 +41,13 @@ export default withRouter(({ location }) => { ...@@ -41,9 +41,13 @@ export default withRouter(({ location }) => {
41 roomId: roomNum, 41 roomId: roomNum,
42 }, 42 },
43 }); 43 });
44 - const { text, createdAt } = messageObj; 44 + if (!messageObj) {
45 - outcomingMsg = text; 45 + toast.error("fail to create new message !, try again");
46 - outcomingTime = createdAt; 46 + } else {
47 + const { text, createdAt } = messageObj;
48 + outcomingMsg = text;
49 + outcomingTime = createdAt;
50 + }
47 } catch { 51 } catch {
48 toast.error("text must be not empty"); 52 toast.error("text must be not empty");
49 } 53 }
......