Skip to content

Commit fe95f46

Browse files
authored
Merge pull request #107 from BinaryStudioAcademy/fix/thjs-62-toast-notification-doesnot-appear-after-post-was-liked
thjs-62: Toast notification does not appear after post was liked
2 parents 3bb205f + 2724930 commit fe95f46

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

client/src/packages/socket/socket-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { io } from 'socket.io-client';
22

33
class Socket {
4-
getInstance = (namespace) => {
4+
getInstance = namespace => {
55
return io(namespace, {
66
transports: ['websocket']
77
});

client/src/packages/store/middlewares/notification-socket/notification-socket.middleware.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable unicorn/prefer-regexp-test */
12
import {
23
NotificationMessage,
34
NotificationSocketEvent,
@@ -30,14 +31,14 @@ const notificationSocket = ({ dispatch }) => {
3031
});
3132

3233
return next => action => {
33-
if (new RegExp(action).test(notificationActionCreator.joinRoom)) {
34+
if (notificationActionCreator.joinRoom.match(action)) {
3435
notificationSocketInstance.emit(
3536
SocketEvent.NOTIFICATION_JOIN_ROOM,
3637
`${action.payload}`
3738
);
3839
}
3940

40-
if (new RegExp(action).test(notificationActionCreator.leaveRoom)) {
41+
if (notificationActionCreator.leaveRoom.match(action)) {
4142
notificationSocketInstance.emit(
4243
SocketEvent.NOTIFICATION_LEAVE_ROOM,
4344
`${action.payload}`

client/vite.config.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ dns.setDefaultResultOrder('verbatim');
88

99
const config = ({ mode }) => {
1010
// import.meta.env doesn't exist at this moment
11-
const { VITE_PORT, VITE_HOST, VITE_API_PATH, VITE_API_SERVER, VITE_SOCKET_SERVER, VITE_SOCKET_PATH } = loadEnv(
12-
mode,
13-
process.cwd()
14-
);
11+
const {
12+
VITE_PORT,
13+
VITE_HOST,
14+
VITE_API_PATH,
15+
VITE_API_SERVER,
16+
VITE_SOCKET_SERVER,
17+
VITE_SOCKET_PATH
18+
} = loadEnv(mode, process.cwd());
1519

1620
return defineConfig({
1721
resolve: {
@@ -27,8 +31,8 @@ const config = ({ mode }) => {
2731
[VITE_API_PATH]: VITE_API_SERVER,
2832
[VITE_SOCKET_PATH]: {
2933
target: VITE_SOCKET_SERVER,
30-
ws: true,
31-
},
34+
ws: true
35+
}
3236
}
3337
},
3438
plugins: [reactPlugin()]

0 commit comments

Comments
 (0)