Parcourir la source

debug: add console logging to ShopDetailPage for error diagnosis

Added comprehensive console logging to ShopDetailPage.loadShopDetail() method to diagnose the shop details loading failure. This will help identify whether the issue is:
- API call failure (auth, CORS, network)
- API returning error response
- Exception during processing

Logging added:
- Shop ID being loaded
- API response object
- Specific error paths (API error vs exception)
- Qdrant call failures

This is a diagnostic commit to identify the root cause of the "Failed to load shop details" error occurring in production where API endpoints work via curl but fail in browser.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fszontagh il y a 8 mois
Parent
commit
64abd1b382
1 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 8 0
      web/src/components/pages/ShopDetailPage.ts

+ 8 - 0
web/src/components/pages/ShopDetailPage.ts

@@ -38,7 +38,9 @@ export class ShopDetailPage {
   private async loadShopDetail(): Promise<void> {
     try {
       // Load shop details first (critical)
+      console.log('[ShopDetailPage] Loading shop details for:', this.shopId);
       const shopResponse = await this.apiService.getShop(this.shopId);
+      console.log('[ShopDetailPage] Shop response:', shopResponse);
 
       if (shopResponse.success && shopResponse.data) {
         this.shopDetail = shopResponse.data;
@@ -52,19 +54,25 @@ export class ShopDetailPage {
         // Handle embeddings response (won't break if it fails)
         if (embeddingsResponse.status === 'fulfilled' && embeddingsResponse.value.success && embeddingsResponse.value.data) {
           this.qdrantEmbeddings = embeddingsResponse.value.data.embeddings;
+        } else if (embeddingsResponse.status === 'rejected') {
+          console.warn('[ShopDetailPage] Embeddings failed:', embeddingsResponse.reason);
         }
 
         // Handle errors response (won't break if it fails)
         if (errorsResponse.status === 'fulfilled' && errorsResponse.value.success && errorsResponse.value.data) {
           this.qdrantErrors = errorsResponse.value.data.errors;
+        } else if (errorsResponse.status === 'rejected') {
+          console.warn('[ShopDetailPage] Errors fetch failed:', errorsResponse.reason);
         }
 
         this.renderShopDetail();
       } else {
+        console.error('[ShopDetailPage] Shop API returned error:', shopResponse.error);
         this.toastService.error('Load Error', shopResponse.error || 'Failed to load shop details');
         this.router.navigate('/shops');
       }
     } catch (error) {
+      console.error('[ShopDetailPage] Exception loading shop details:', error);
       this.toastService.error('Error', 'Failed to load shop details');
       this.router.navigate('/shops');
     }