kevin/reviews-page #33

Merged
fr merged 10 commits from kevin/reviews-page into main 2024-05-15 02:54:09 +02:00
2 changed files with 12 additions and 6 deletions
Showing only changes of commit 2041c8998a - Show all commits

View File

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

View File

@ -4,8 +4,11 @@ import Button from "@components/Button";
import { colors } from "@components/style"; import { colors } from "@components/style";
import { router } from "expo-router"; import { router } from "expo-router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useAuth } from "@context/AuthContext";
export default function Tab() { export default function Tab() {
const { authState } = useAuth();
const user = authState.user;
const [data, setData] = useState([]); const [data, setData] = useState([]);
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
@ -17,8 +20,11 @@ export default function Tab() {
method: "GET", method: "GET",
credentials: "include", credentials: "include",
}); });
const data = await res.json(); let data = await res.json();
setData(data.data); // 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) { } catch (err) {
console.error(err); console.error(err);
alert("Something went wrong"); alert("Something went wrong");