File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
frontend/apps/example/src/app Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,24 @@ export default function Home() {
4242 fetchResult . status === 201
4343 ) {
4444 const data = await fetchResult . json ( ) ;
45- return new Promise < Record < string , unknown > > ( ( resolve ) => {
46- if ( fetchResult . status === 510 || fetchResult . status === 400 ) {
47- resolve ( { ...data , status : fetchResult . status } ) ;
48- }
49- if ( fetchResult . status === 200 ) {
50- resolve ( { status : 200 , data } ) ;
51- }
52- } ) ;
45+
46+ return new Promise < Record < string , unknown > > (
47+ ( resolve , reject ) => {
48+ if (
49+ fetchResult . status === 510 ||
50+ fetchResult . status === 400
51+ ) {
52+ resolve ( {
53+ ...data ,
54+ status : fetchResult . status ,
55+ } ) ;
56+ }
57+ if ( fetchResult . status === 200 ) {
58+ resolve ( { status : 200 , data } ) ;
59+ }
60+ reject ( 'No valid status in response' ) ;
61+ } ,
62+ ) ;
5363 }
5464 throw new Error (
5565 `Status not 400, 510 or 200: ${ fetchResult . statusText } ` ,
You can’t perform that action at this time.
0 commit comments