sdy

update outcomingMsg data type

......@@ -14,7 +14,7 @@ export default withRouter(({ location }) => {
const { pathname } = location;
const roomName = pathname.slice(1, pathname.length);
let messageObj, outcomingMsg, roomId;
let messageObj, outcomingMsg, outcomingTime, roomNum;
if (roomName !== undefined) {
const { data } = useQuery(GET_ROOM_BY_NAME, { variables: { roomName } });
......@@ -23,7 +23,7 @@ export default withRouter(({ location }) => {
getRoomByName: { id: roomId },
},
} = data;
console.log(roomId);
roomNum = Number(roomId);
}
const [createMsg] = useMutation(WHOLE_MESSAGE);
......@@ -38,12 +38,12 @@ export default withRouter(({ location }) => {
messageObj = await createMsg({
variables: {
message: message.value,
roomId,
roomId: roomNum,
},
});
const { text } = messageObj;
const { text, createdAt } = messageObj;
outcomingMsg = text;
console.log(messageObj);
outcomingTime = createdAt;
} catch {
toast.error("text must be not empty");
}
......@@ -55,6 +55,7 @@ export default withRouter(({ location }) => {
message={message}
onSubmit={onSubmit}
outcomingMsg={outcomingMsg}
outcomingTime={outcomingTime}
/>
);
});
......