Skip to content

Commit 61185b8

Browse files
committed
fix: populate restaurant name and menu item name on review flow submit
1 parent 048abdb commit 61185b8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

frontend/components/MyReview.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { createReview } from "@/api/review";
1818
import useAuthStore from "@/auth/store";
1919
import * as ImagePicker from "expo-image-picker";
2020
import { uploadMultipleImagesToS3 } from "@/utils/s3uploads";
21+
import { getRestaurant } from "@/api/restaurant";
2122

2223
interface MyReviewProps {
2324
restaurantId?: string;
@@ -45,6 +46,15 @@ function generateValidObjectId() {
4546
export 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

Comments
 (0)