Oprava ukládání dat při změně
This commit is contained in:
parent
b1138bc104
commit
24c301b141
@ -255,6 +255,7 @@ export function removeChoices(login: string, location: Locations) {
|
||||
if (Object.keys(data.choices[location]).length === 0) {
|
||||
delete data.choices[location]
|
||||
}
|
||||
db.set(today, data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
@ -274,8 +275,10 @@ export function removeChoice(login: string, location: Locations, foodIndex: numb
|
||||
let data: ClientData = db.get(today);
|
||||
if (location in data.choices) {
|
||||
if (login in data.choices[location]) {
|
||||
if (data.choices[location][login].includes(foodIndex)) {
|
||||
data.choices[location][login].splice(foodIndex, 1)
|
||||
const index = data.choices[location][login].indexOf(foodIndex);
|
||||
if (index > -1) {
|
||||
data.choices[location][login].splice(index, 1)
|
||||
db.set(today, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user