parent
24dc1f80b3
commit
c3c87b005c
@ -68,8 +68,7 @@ export type APIEndPoint = {
|
|||||||
export const removeEntry = (store: Store, entry: ItemType): Store => {
|
export const removeEntry = (store: Store, entry: ItemType): Store => {
|
||||||
const [storeIndex, dateString] = getToday(ensureToday(store))!;
|
const [storeIndex, dateString] = getToday(ensureToday(store))!;
|
||||||
const today = store.entries[storeIndex];
|
const today = store.entries[storeIndex];
|
||||||
const indexHit = today.items.findIndex((item) => JSON.stringify(item) !== JSON.stringify(entry));
|
today.items = today.items.filter((item) => JSON.stringify(item) !== JSON.stringify(entry));
|
||||||
today.items = today.items.filter((_, i) => i !== indexHit);
|
|
||||||
store.entries[storeIndex] = today;
|
store.entries[storeIndex] = today;
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user