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-06-01 05:47:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d9e2afc097ee4ff2b00c3c3780eb681e79596309
d9e2afc0
1 parent
1f7067d5
update subscription
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
front/src/Routes/Chat/ChatContainer.js
front/src/Routes/Chat/ChatContainer.js
View file @
d9e2afc
...
...
@@ -15,7 +15,9 @@ export default withRouter(({ location }) => {
const
{
pathname
}
=
location
;
const
roomName
=
pathname
.
slice
(
1
,
pathname
.
length
);
const
[
createMsg
]
=
useMutation
(
CREATE_MESSAGE
);
const
{
data
:
subScription
}
=
useSubscription
(
SUBSCRIPTION_MSG
);
const
{
data
:
subMessage
}
=
useSubscription
(
SUBSCRIPTION_MSG
);
console
.
log
(
"subMessage : "
,
subMessage
);
const
message
=
useInput
(
""
);
...
...
@@ -46,18 +48,16 @@ export default withRouter(({ location }) => {
let
testObj
;
testObj
=
subscribeToMore
({
document
:
SUBSCRIPTION_MSG
,
document
:
subMessage
,
updateQuery
:
(
prev
,
{
subscriptionData
})
=>
{
console
.
log
(
"prev : "
,
prev
);
console
.
log
(
"subscriptionData : "
,
subscriptionData
);
if
(
!
subscriptionData
.
data
)
return
prev
;
const
newFeedItem
=
subscriptionData
.
data
.
subMessage
;
console
.
log
(
"newFeedItem : "
,
newFeedItem
);
return
Object
.
assign
({},
prev
,
{
seeAllMessage
:
{
id
,
},
});
return
{
seeAllMessage
:
[
...
prev
.
seeAllMessage
,
subscriptionData
.
data
.
subMessage
,
],
};
},
});
console
.
log
(
testObj
);
...
...
Please
register
or
login
to post a comment