aretherecookies-mobile/js/streams/FoodItemsStream.js
2017-04-14 12:28:48 -05:00

55 lines
1.6 KiB
JavaScript

//@flow
import FoodItemRecord from '../records/FoodItemRecord';
import { Observable } from 'rxjs';
import { List } from 'immutable';
import { pushInto } from '../helpers/ImmutableHelpers';
// TODO open a websoket and create observable from it
const DUMMY_DATA = [
{
id: 1,
name: 'Big John Cookies',
placeId: 1,
images: [
'https://s-media-cache-ak0.pinimg.com/564x/e7/5f/08/e75f08b00c0bc7f2b01b3d1a636389f6.jpg',
'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg',
'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg',
'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg',
'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg',
],
thumbImage: 'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg',
titleImage: 'https://s-media-cache-ak0.pinimg.com/564x/e7/5f/08/e75f08b00c0bc7f2b01b3d1a636389f6.jpg',
},
{
id: 2,
name: 'Jelly Filled Donuts',
placeId: 1,
},
{
id: 3,
name: 'Spelt Brownies',
placeId: 1,
},
{
id: 4,
name: 'Oatmeal Raisin Cookies',
placeId: 1,
},
{
id: 5,
name: 'Donuts with Sprinkles',
placeId: 1,
},
{
id: 6,
name: 'Powdered Donuts',
placeId: 1,
},
{
id: 7,
name: 'Snickerdoodles',
placeId: 1,
},
];
export default Observable.from(DUMMY_DATA.concat(DUMMY_DATA)).map(FoodItemRecord).scan(pushInto, List());