reviews + UI

This commit is contained in:
User
2025-02-16 11:17:40 +03:00
parent 73c80dcc16
commit fa53707210
7 changed files with 182 additions and 128 deletions

View File

@@ -17,20 +17,19 @@ export function ReviewForm({ productId }: ReviewFormProps) {
const [rating, setRating] = useState(0)
const [comment, setComment] = useState("")
const { isLoggedIn } = useAuth()
const {email} = useAuth();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
const reviewData = {
username: {email}=useAuth(), // Здесь можно подтянуть имя из Auth-контекста
username: "No name", // Здесь можно подтянуть имя из Auth-контекста
rating,
comment,
}
try {
const response = await fetch(`http://localhost:8080/product/1`, {
const response = await fetch(`http://localhost:8080/product/${productId}`, {
method: "POST",
headers: {
"Content-Type": "application/json",