File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -32,13 +32,24 @@ function App() {
3232 } ) ;
3333 console . log ( 'Response status:' , res . status ) ;
3434 if ( res . ok ) {
35- const json = await res . json ( ) . catch ( ( e ) => {
36- console . error ( 'Failed to parse JSON from 200 response:' , e ) ;
37- return { } ;
38- } ) ;
39- console . log ( 'Parsed JSON:' , json ) ;
40- setData ( json ) ;
41- setIsFallback ( false ) ;
35+ // Attempt to read raw text for debugging
36+ let text = '' ;
37+ try {
38+ text = await res . text ( ) ;
39+ console . log ( 'Raw 200 response text:' , text ) ;
40+ const json = JSON . parse ( text ) ;
41+ console . log ( 'Parsed JSON:' , json ) ;
42+ setData ( json ) ;
43+ setIsFallback ( false ) ;
44+ setError ( '' ) ;
45+ return ;
46+ } catch ( e ) {
47+ console . error ( 'Error parsing JSON from 200 response:' , e ) ;
48+ console . error ( 'Response text was:' , text ) ;
49+ setError ( 'Invalid JSON response from server' ) ;
50+ setLoading ( false ) ;
51+ return ;
52+ }
4253 } else if ( res . status === 422 ) {
4354 // Validation error: fallback flow
4455 let errJson = { } ;
You can’t perform that action at this time.
0 commit comments