mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 05:54:56 -06:00
snackbar on food item creation success
This commit is contained in:
parent
5000a7049e
commit
9ebc5e4668
1 changed files with 5 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import CreateFoodItem$, { emitter as emitCreateItemState } from '../streams/Crea
|
|||
import { emitter as emitFoodItemsState } from '../streams/FoodItemsStream';
|
||||
import { createFoodItem } from '../apis/FoodItemsApi';
|
||||
import FoodItemRecord, { createFoodItem as buildFoodItem } from '../records/FoodItemRecord';
|
||||
import Snackbar from 'react-native-snackbar';
|
||||
|
||||
// should throw an error if not valid
|
||||
const isFoodItemValid = () => true;
|
||||
|
|
@ -21,6 +22,10 @@ export const withCreateFoodItemState = mapPropsStream(props$ => {
|
|||
// insert new item into db and cast it into FoodItemRecord
|
||||
const newItem = buildFoodItem(await createFoodItem(foodItem));
|
||||
|
||||
Snackbar.show({
|
||||
title: foodItem.name + ' added',
|
||||
});
|
||||
|
||||
// notify food items state of new item
|
||||
emitFoodItemsState(newItem);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue