1
0

Updated the SettingsProvider.jsx

This commit is contained in:
Mathias Wagner 2023-11-23 08:10:20 +01:00
parent 56b183fbc8
commit 0ae2b7ff96
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -20,6 +20,31 @@ export const SettingsProvider = ({children}) => {
setRounds(newValue);
}
const updateStartCapital = (newValue) => {
localStorage.setItem("startCapital", newValue);
setStartCapital(newValue);
}
const updateCostPerCake = (newValue) => {
localStorage.setItem("costPerCake", newValue);
setCostPerCake(newValue);
}
const updateCostPerRound = (newValue) => {
localStorage.setItem("costPerRound", newValue);
setCostPerRound(newValue);
}
const updateProduction = (newValue) => {
localStorage.setItem("maxProduction", newValue);
setMaxProduction(newValue);
}
const updatePrice = (newValue) => {
localStorage.setItem("maxProduction", newValue);
setMaxPrice(newValue);
}
const updateDemandTable = (newValue) => {
localStorage.setItem("demandTable", JSON.stringify(newValue));
setDemandTable(newValue);
@ -27,9 +52,9 @@ export const SettingsProvider = ({children}) => {
return (
<SettingsContext.Provider value={{
rounds, updateRounds, demandTable, updateDemandTable, startCapital, setStartCapital,
costPerCake, setCostPerCake, costPerRound, setCostPerRound, maxProduction, setMaxProduction,
maxPrice, setMaxPrice
rounds, updateRounds, demandTable, updateDemandTable, startCapital, updateStartCapital,
costPerCake, updateCostPerCake, costPerRound, updateCostPerRound, maxProduction, updateProduction,
maxPrice, updatePrice
}}>
{children}
</SettingsContext.Provider>