sdy

rename variables

...@@ -14,7 +14,7 @@ export default withRouter(({ location }) => { ...@@ -14,7 +14,7 @@ export default withRouter(({ location }) => {
14 const { pathname } = location; 14 const { pathname } = location;
15 const roomName = pathname.slice(1, pathname.length); 15 const roomName = pathname.slice(1, pathname.length);
16 16
17 - let messageObj, outcomingMsg, outcomingTime, roomNum; 17 + let messageObj, roomNum, sendingText, sendingTime, sendingMsgObj;
18 18
19 if (roomName !== undefined) { 19 if (roomName !== undefined) {
20 const { data } = useQuery(GET_ROOM_BY_NAME, { variables: { roomName } }); 20 const { data } = useQuery(GET_ROOM_BY_NAME, { variables: { roomName } });
...@@ -44,9 +44,14 @@ export default withRouter(({ location }) => { ...@@ -44,9 +44,14 @@ export default withRouter(({ location }) => {
44 if (!messageObj) { 44 if (!messageObj) {
45 toast.error("fail to create new message !, try again"); 45 toast.error("fail to create new message !, try again");
46 } else { 46 } else {
47 - const { text, createdAt } = messageObj; 47 + const {
48 - outcomingMsg = text; 48 + data: {
49 - outcomingTime = createdAt; 49 + wholeMessage: { text, createdAt },
50 + },
51 + } = messageObj;
52 + sendingText = text;
53 + sendingTime = createdAt;
54 + sendingMsgObj = messageObj;
50 } 55 }
51 } catch { 56 } catch {
52 toast.error("text must be not empty"); 57 toast.error("text must be not empty");
...@@ -58,8 +63,9 @@ export default withRouter(({ location }) => { ...@@ -58,8 +63,9 @@ export default withRouter(({ location }) => {
58 location={location} 63 location={location}
59 message={message} 64 message={message}
60 onSubmit={onSubmit} 65 onSubmit={onSubmit}
61 - outcomingMsg={outcomingMsg} 66 + sendingText={sendingText}
62 - outcomingTime={outcomingTime} 67 + sendingTime={sendingTime}
68 + sendingMsgObj={sendingMsgObj}
63 /> 69 />
64 ); 70 );
65 }); 71 });
......