mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 04:24:56 -06:00
make POST requests to /quantity to update the quantity of an existing food item - then mixin the new quantity with the existing food items observable
15 lines
402 B
JavaScript
15 lines
402 B
JavaScript
// @flow
|
|
import { type List, type Map } from 'immutable';
|
|
|
|
export const pushInto = <T>(list: List<T>, item: T): List<T> => list.push(item);
|
|
|
|
export function merge(a: Map<any, Object>, b: Map<any, Object>) {
|
|
return a.merge(b);
|
|
}
|
|
|
|
export const setById = (map: Map<string, any>, item: ?{ id?: string }): Map<string, any> => {
|
|
if (!item || !item.id) {
|
|
return map;
|
|
}
|
|
return map.set(item.id, item);
|
|
};
|