Added GroupContext.jsx#resetGame
This commit is contained in:
parent
a47b3a87bd
commit
0124467b6a
@ -47,6 +47,12 @@ export const GroupProvider = ({children}) => {
|
|||||||
setRound([]);
|
setRound([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resetGame = () => {
|
||||||
|
setAllGroups([]);
|
||||||
|
setGroups([]);
|
||||||
|
setRound([]);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
socket.on("JOINED", handleJoin);
|
socket.on("JOINED", handleJoin);
|
||||||
socket.on("LEFT", handleLeave);
|
socket.on("LEFT", handleLeave);
|
||||||
@ -58,7 +64,7 @@ export const GroupProvider = ({children}) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GroupContext.Provider value={{groups, round, handleRound, getGroupById, updateCapital, endRound, allGroups}}>
|
<GroupContext.Provider value={{groups, round, handleRound, getGroupById, updateCapital, endRound, allGroups, resetGame}}>
|
||||||
{children}
|
{children}
|
||||||
</GroupContext.Provider>
|
</GroupContext.Provider>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user