Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #40 from exortme1ster/feature/implement-websocket
Browse files Browse the repository at this point in the history
feat: implement websocket
  • Loading branch information
nmashchenko committed May 12, 2023
2 parents 0d67ba4 + 795c07f commit 9555af4
Show file tree
Hide file tree
Showing 44 changed files with 19,209 additions and 10,670 deletions.
221 changes: 209 additions & 12 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"country-code-lookup": "^0.0.20",
"dotenv": "^16.0.1",
"formik": "^2.2.9",
"framer-motion": "^10.12.10",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"notistack": "^2.0.5",
Expand All @@ -39,6 +40,7 @@
"react-select": "^5.4.0",
"react-select-country-list": "^2.2.3",
"redux": "^4.2.0",
"socket.io-client": "^4.6.1",
"styled-components": "^5.3.5",
"uuidv4": "^5.0.1",
"web-vitals": "^2.1.4",
Expand Down
6 changes: 3 additions & 3 deletions client/src/api/hooks/sidebar/useReadMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export const useReadMessages = () => {
const queryClient = useQueryClient()

const readMessages = async (idsArr) => {
return await api.put('notifications/read', idsArr)
return await api.put('notifications/read', { notifications: idsArr })
}

return useMutation(readMessages, {
mutationKey: 'finishRegistration',
mutationKey: 'readMessages',
onSuccess: () => {
queryClient.invalidateQueries('checkAuth', { refetchInactive: true })
console.log('success!')
},
onError: (error) => {
// set error message
Expand Down
5 changes: 5 additions & 0 deletions client/src/api/sockets/notifications.socket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { io } from 'socket.io-client'

import { LOCAL_PATH } from '../../http'

export const socket = io(LOCAL_PATH)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const CreateTeamContainer = styled.div`
`

export const Card = styled.div`
height: calc(100vh - 78px);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
Expand Down
Loading

0 comments on commit 9555af4

Please sign in to comment.