@@ -18,6 +18,7 @@ import { createReview } from "@/api/review";
1818import useAuthStore from "@/auth/store" ;
1919import * as ImagePicker from "expo-image-picker" ;
2020import { uploadMultipleImagesToS3 } from "@/utils/s3uploads" ;
21+ import { getRestaurant } from "@/api/restaurant" ;
2122
2223interface MyReviewProps {
2324 restaurantId ?: string ;
@@ -45,6 +46,15 @@ function generateValidObjectId() {
4546export function MyReview ( { restaurantId, menuItemName, dishImageUrl, onClose, onSubmit } : MyReviewProps ) {
4647 const [ step , setStep ] = useState ( 1 ) ;
4748 const user = useAuthStore ( ( state ) => state . userId ) ;
49+ const [ restaurantName , setRestaurantName ] = useState ( "" ) ;
50+
51+ useEffect ( ( ) => {
52+ if ( restaurantId ) {
53+ getRestaurant ( restaurantId ) . then ( ( restaurant ) => {
54+ setRestaurantName ( restaurant . name ) ;
55+ } ) ;
56+ }
57+ } , [ restaurantId ] ) ;
4858
4959 // Track star ratings
5060 const [ tasteRating , setTasteRating ] = useState ( 0 ) ;
@@ -191,6 +201,8 @@ export function MyReview({ restaurantId, menuItemName, dishImageUrl, onClose, on
191201 } ,
192202 menuItem : "64f5a95cc7330b78d33265f2" ,
193203 restaurantId : restaurantId || "64f5a95cc7330b78d33265f1" ,
204+ menuItemName : menuItemName || "" ,
205+ restaurantName : restaurantName || "" ,
194206 additionalImages : uploadedImageUrls . slice ( 1 ) ,
195207 } ;
196208
0 commit comments