Updated the SettingsProvider.jsx
This commit is contained in:
parent
56b183fbc8
commit
0ae2b7ff96
@ -20,6 +20,31 @@ export const SettingsProvider = ({children}) => {
|
|||||||
setRounds(newValue);
|
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) => {
|
const updateDemandTable = (newValue) => {
|
||||||
localStorage.setItem("demandTable", JSON.stringify(newValue));
|
localStorage.setItem("demandTable", JSON.stringify(newValue));
|
||||||
setDemandTable(newValue);
|
setDemandTable(newValue);
|
||||||
@ -27,9 +52,9 @@ export const SettingsProvider = ({children}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsContext.Provider value={{
|
<SettingsContext.Provider value={{
|
||||||
rounds, updateRounds, demandTable, updateDemandTable, startCapital, setStartCapital,
|
rounds, updateRounds, demandTable, updateDemandTable, startCapital, updateStartCapital,
|
||||||
costPerCake, setCostPerCake, costPerRound, setCostPerRound, maxProduction, setMaxProduction,
|
costPerCake, updateCostPerCake, costPerRound, updateCostPerRound, maxProduction, updateProduction,
|
||||||
maxPrice, setMaxPrice
|
maxPrice, updatePrice
|
||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
</SettingsContext.Provider>
|
</SettingsContext.Provider>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user