1
0

Added the roundHistory & groupName states in the GroupContext.jsx

This commit is contained in:
Mathias Wagner 2023-11-22 12:09:30 +01:00
parent 05509ddfda
commit 0725a90976
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -8,6 +8,8 @@ export const GroupProvider = ({children}) => {
const [allGroups, setAllGroups] = useState([]); const [allGroups, setAllGroups] = useState([]);
const [groups, setGroups] = useState([]); const [groups, setGroups] = useState([]);
const [round, setRound] = useState([]); const [round, setRound] = useState([]);
const [roundHistory, setRoundHistory] = useState([]);
const [groupName, setGroupName] = useState("");
const handleJoin = (group) => { const handleJoin = (group) => {
setGroups(groups => [...groups, {...group, capital: 25000}]); setGroups(groups => [...groups, {...group, capital: 25000}]);
@ -64,7 +66,8 @@ export const GroupProvider = ({children}) => {
}, []); }, []);
return ( return (
<GroupContext.Provider value={{groups, round, handleRound, getGroupById, updateCapital, endRound, allGroups, resetGame}}> <GroupContext.Provider value={{groups, round, handleRound, getGroupById, updateCapital, endRound,
allGroups, resetGame, groupName, setGroupName, roundHistory, setRoundHistory}}>
{children} {children}
</GroupContext.Provider> </GroupContext.Provider>
) )