From 2041c8998a6cdaba694e18189efe01dfdb63ccd5 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Wed, 15 May 2024 02:04:16 +0200 Subject: [PATCH] Fixed: fetching review data, typos --- frontend/app/(app)/(tabs)/review/add/[beer_id].js | 8 ++++---- frontend/app/(app)/(tabs)/review/index.js | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/frontend/app/(app)/(tabs)/review/add/[beer_id].js b/frontend/app/(app)/(tabs)/review/add/[beer_id].js index 731b23d..24476d3 100644 --- a/frontend/app/(app)/(tabs)/review/add/[beer_id].js +++ b/frontend/app/(app)/(tabs)/review/add/[beer_id].js @@ -43,7 +43,7 @@ export default function reviewAdd() { ), }, { - label: "Excelent", + label: "Excellent", value: "3", icon: () => ( ( ( ( { fetchData(); @@ -17,8 +20,11 @@ export default function Tab() { method: "GET", credentials: "include", }); - const data = await res.json(); - setData(data.data); + let data = await res.json(); + // show only logged in user's data + data = data.data.filter((review) => review.user_id == user._id); + console.log("reviews", data); + setData(data); } catch (err) { console.error(err); alert("Something went wrong");