mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 02:44:56 -06:00
wip converting to products from scraper
This commit is contained in:
parent
caa5eb2166
commit
451b63b71c
4 changed files with 10 additions and 11 deletions
|
|
@ -21,13 +21,14 @@ export const fetchFaves = withLoggedInEmail(async email => {
|
|||
});
|
||||
});
|
||||
|
||||
export const putFaves = withLoggedInEmail(async (email, productIds) => {
|
||||
export const putFaves = withLoggedInEmail(async (email, productId, photoUrl) => {
|
||||
return fetchRequest({
|
||||
endpoint: '/fave',
|
||||
method: 'PUT',
|
||||
body: {
|
||||
email,
|
||||
productIds,
|
||||
productId,
|
||||
photoUrl,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const ProductImages = ({
|
|||
<Image
|
||||
style={{ flex: 1, resizeMode: 'contain' }}
|
||||
resizeMethod="scale"
|
||||
source={{ uri: get(visibleImages.first(), 'url', '') }}
|
||||
source={{ uri: visibleImages.first() }}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
|
|
@ -63,12 +63,12 @@ const ProductImages = ({
|
|||
onAnimateNextPage={changeCurrentImage}
|
||||
style={stretchedStyle}
|
||||
currentPage={currentImage}>
|
||||
{visibleImages.map(image => (
|
||||
{visibleImages.map(imageUrl => (
|
||||
<Image
|
||||
key={get(image, 'url', '')}
|
||||
key={imageUrl}
|
||||
style={{ flex: 1, resizeMode: 'cover' }}
|
||||
resizeMethod="resize"
|
||||
source={{ uri: get(image, 'url', '') }}
|
||||
source={{ uri: imageUrl }}
|
||||
/>
|
||||
))}
|
||||
</Carousel>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { Set, Record } from 'immutable';
|
|||
import { type RawProduct } from '../apis/ProductsApi';
|
||||
import { type Category } from '../constants/CategoryConstants';
|
||||
import { type Quantity } from '../constants/QuantityConstants';
|
||||
import ImageRecord, { buildImageRecord } from './ImageRecord';
|
||||
|
||||
export type Product = {
|
||||
id: ?string,
|
||||
|
|
@ -13,7 +12,7 @@ export type Product = {
|
|||
distance: number,
|
||||
quantity: Quantity,
|
||||
category: Category,
|
||||
images: Set<ImageRecord>,
|
||||
images: Set<string>,
|
||||
thumbImage: ?string,
|
||||
titleImage: ?string,
|
||||
lastupdated: number,
|
||||
|
|
@ -45,8 +44,7 @@ export const createProduct = (productRaw: ?RawProduct) => {
|
|||
...productRaw,
|
||||
placeType: productRaw.placeType,
|
||||
thumbImage: productRaw.thumbimage,
|
||||
// images: new Set(map(buildImageRecord, pathOr([], ['images'], productRaw))),
|
||||
images: new Set([buildImageRecord({ url: productRaw.thumbimage })]),
|
||||
images: new Set([productRaw.thumbimage]),
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export function emitOne(fave: ?Fave) {
|
|||
export default observable
|
||||
.combineLatest(products$)
|
||||
.map(([faves, products]) => {
|
||||
return faves && faves.map(fave => get(products, get(fave, 'food_item_id')));
|
||||
return faves && faves.map(fave => get(products, get(fave, 'product_id')));
|
||||
})
|
||||
.combineLatest(filter$)
|
||||
.map(([faveProducts, filter]) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue