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 + if (!messageObj) {
45 + toast.error("fail to create new message !, try again");
46 + } else {
44 const { text, createdAt } = messageObj; 47 const { text, createdAt } = messageObj;
45 outcomingMsg = text; 48 outcomingMsg = text;
46 outcomingTime = createdAt; 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 }
......