Add enhanced debugging for review API response
Added console logging to track: - When fetchReviews is called - Raw API response data - Any errors from Supabase This will help debug why reviewer_name is not appearing in the API response. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,8 @@ export function ProductReviews({ productId, type }: ProductReviewsProps) {
|
||||
}, [productId, type]);
|
||||
|
||||
const fetchReviews = async () => {
|
||||
console.log('fetchReviews called - productId:', productId, 'type:', type);
|
||||
|
||||
let query = supabase
|
||||
.from('reviews')
|
||||
.select('id, rating, title, body, created_at, reviewer_name, profiles!user_id (name)')
|
||||
@@ -39,9 +41,10 @@ export function ProductReviews({ productId, type }: ProductReviewsProps) {
|
||||
query = query.eq('type', type);
|
||||
}
|
||||
|
||||
const { data } = await query.order('created_at', { ascending: false }).limit(3);
|
||||
const { data, error } = await query.order('created_at', { ascending: false }).limit(3);
|
||||
|
||||
console.log('Raw reviews data:', data);
|
||||
console.log('Error:', error);
|
||||
|
||||
if (data && data.length > 0) {
|
||||
const typedData = data as unknown as Review[];
|
||||
|
||||
Reference in New Issue
Block a user