Question (Solved)
Hi every one, I am stuck with problem {"_A","_x","_y","_z"} In my model, each of BasketDIsh has one Dish so I create new BasketDish and saved but when I call console.log(basketDish) at BasketDishItem, I can't find "Dish : ~ " console.log(basketDish.Dish) saids {"_A" : null,"_x": 0 ,"_y": 1,"_z": null} and if I refresh => {"_A" : null,"_x": 0 ,"_y": 1,"_z": { dish data }} I wish Dish shows at basketDish, Can somebody help me? --------------------------------------------------------- Graphql type BasketDish @model @auth(rules: [{allow: public}]) { id: ID! quantity: Int! Dish: Dish @hasOne basketID: ID! @index(name: "byBasket") } type Dish @model @auth(rules: [{allow: public}]) { id: ID! name: String! image: String description: String price: Float! restaurantID: ID! @index(name: "byRestaurant") } --------------------------------------------------------- BasketContext.js const addDishToBasket = async (dish, quantity) => { let theBasket = basket || (await createNewBasket()); console.log("theBasket.id",theBasket.id); const newDish = await DataStore.save( new BasketDish({ quantity, Dish: dish.id, basketID: theBasket.id }) ); setBasketDishes([...basketDishes, newDish]); }; --------------------------------------------------------- const BasketDishItem = ({ basketDish }) => { console.log("basketDish", basketDish); console.log("basketDish", basketDish.Dish); return ( <View style={styles.row}> <View style={styles.quantityContainer}> <Text>{basketDish.quantity}</Text> </View> <Text style={{ fontWeight: "600" }}>{basketDish.Dish.name}</Text> <Text style={{ marginLeft: "auto" }}>$ {basketDish.Dish.price}</Text> </View> ); }; ---------------------------------------------------------
View in Discord