reviews + UI
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user