mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-14 04:25:35 +01:00
Fix EsLint config & update packages
This commit is contained in:
@@ -6,6 +6,7 @@ export function playerReducer(state, action) {
|
||||
switch (action.type) {
|
||||
case "JOIN":
|
||||
return { player: { ...state.player, room: action.payload } }
|
||||
|
||||
case "LOGIN":
|
||||
return {
|
||||
player: {
|
||||
@@ -14,10 +15,13 @@ export function playerReducer(state, action) {
|
||||
points: 0,
|
||||
},
|
||||
}
|
||||
|
||||
case "UPDATE":
|
||||
return { player: { ...state.player, ...action.payload } }
|
||||
|
||||
case "LOGOUT":
|
||||
return { player: null }
|
||||
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@ export const socket = io(WEBSOCKET_PUBLIC_URL, {
|
||||
|
||||
export const SocketContext = createContext()
|
||||
|
||||
export const SocketContextProvider = ({ children }) => {
|
||||
return (
|
||||
<SocketContext.Provider value={socket}>{children}</SocketContext.Provider>
|
||||
)
|
||||
}
|
||||
export const SocketContextProvider = ({ children }) => (
|
||||
<SocketContext.Provider value={socket}>{children}</SocketContext.Provider>
|
||||
)
|
||||
|
||||
export function useSocketContext() {
|
||||
const context = useContext(SocketContext)
|
||||
|
||||
Reference in New Issue
Block a user