|
@@ -19,7 +19,7 @@ const logger = loggerFactory('growi:InAppNotificationDropdown');
|
|
|
type Props = {
|
|
type Props = {
|
|
|
appContainer: AppContainer,
|
|
appContainer: AppContainer,
|
|
|
socketIoContainer: SocketIoContainer,
|
|
socketIoContainer: SocketIoContainer,
|
|
|
- me: string,
|
|
|
|
|
|
|
+ currentUserId: string,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const InAppNotificationDropdown: FC<Props> = (props: Props) => {
|
|
const InAppNotificationDropdown: FC<Props> = (props: Props) => {
|
|
@@ -36,10 +36,11 @@ const InAppNotificationDropdown: FC<Props> = (props: Props) => {
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
const initializeSocket = (props) => {
|
|
const initializeSocket = (props) => {
|
|
|
- console.log(props);
|
|
|
|
|
-
|
|
|
|
|
const socket = props.socketIoContainer.getSocket();
|
|
const socket = props.socketIoContainer.getSocket();
|
|
|
socket.on('commentUpdated', (data: { userId: string, count: number }) => {
|
|
socket.on('commentUpdated', (data: { userId: string, count: number }) => {
|
|
|
|
|
+ if (data.userId === props.currentUserId) {
|
|
|
|
|
+ setCount(data.count);
|
|
|
|
|
+ }
|
|
|
// eslint-disable-next-line no-console
|
|
// eslint-disable-next-line no-console
|
|
|
console.log('socketData', data);
|
|
console.log('socketData', data);
|
|
|
});
|
|
});
|