Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-05-28 22:21:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1d153a87969b15a653509f5f141a540d971a62ad
1d153a87
1 parent
c48af3cd
rename variables
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
front/src/Routes/Chat/ChatContainer.js
front/src/Routes/Chat/ChatContainer.js
View file @
1d153a8
...
...
@@ -14,7 +14,7 @@ export default withRouter(({ location }) => {
const
{
pathname
}
=
location
;
const
roomName
=
pathname
.
slice
(
1
,
pathname
.
length
);
let
messageObj
,
outcomingMsg
,
outcomingTime
,
roomNum
;
let
messageObj
,
roomNum
,
sendingText
,
sendingTime
,
sendingMsgObj
;
if
(
roomName
!==
undefined
)
{
const
{
data
}
=
useQuery
(
GET_ROOM_BY_NAME
,
{
variables
:
{
roomName
}
});
...
...
@@ -44,9 +44,14 @@ export default withRouter(({ location }) => {
if
(
!
messageObj
)
{
toast
.
error
(
"fail to create new message !, try again"
);
}
else
{
const
{
text
,
createdAt
}
=
messageObj
;
outcomingMsg
=
text
;
outcomingTime
=
createdAt
;
const
{
data
:
{
wholeMessage
:
{
text
,
createdAt
},
},
}
=
messageObj
;
sendingText
=
text
;
sendingTime
=
createdAt
;
sendingMsgObj
=
messageObj
;
}
}
catch
{
toast
.
error
(
"text must be not empty"
);
...
...
@@ -58,8 +63,9 @@ export default withRouter(({ location }) => {
location
=
{
location
}
message
=
{
message
}
onSubmit
=
{
onSubmit
}
outcomingMsg
=
{
outcomingMsg
}
outcomingTime
=
{
outcomingTime
}
sendingText
=
{
sendingText
}
sendingTime
=
{
sendingTime
}
sendingMsgObj
=
{
sendingMsgObj
}
/
>
);
});
...
...
Please
register
or
login
to post a comment