Fixed: fetching review data, typos

This commit is contained in:
Filip Rojek 2024-05-15 02:04:16 +02:00
parent cff010f2b4
commit 2041c8998a
2 changed files with 12 additions and 6 deletions

View File

@ -43,7 +43,7 @@ export default function reviewAdd() {
),
},
{
label: "Excelent",
label: "Excellent",
value: "3",
icon: () => (
<Image
@ -78,7 +78,7 @@ export default function reviewAdd() {
),
},
{
label: "Excelent",
label: "Excellent",
value: "3",
icon: () => (
<Image
@ -133,7 +133,7 @@ export default function reviewAdd() {
),
},
{
label: "Excelent!",
label: "Excellent!",
value: "5",
icon: () => (
<Image
@ -188,7 +188,7 @@ export default function reviewAdd() {
),
},
{
label: "Excelent!",
label: "Excellent!",
value: "5",
icon: () => (
<Image

View File

@ -4,8 +4,11 @@ import Button from "@components/Button";
import { colors } from "@components/style";
import { router } from "expo-router";
import { useEffect, useState } from "react";
import { useAuth } from "@context/AuthContext";
export default function Tab() {
const { authState } = useAuth();
const user = authState.user;
const [data, setData] = useState([]);
useEffect(() => {
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");