File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,13 @@ const UploadAvatar = ({
59
59
body : JSON . stringify ( { image : blobUrl } ) ,
60
60
} ) . then ( async ( res ) => {
61
61
setUploading ( false ) ;
62
- if ( res . status === 201 ) {
63
- await update ( ) ;
64
- toast . success ( "Successfully updated your profile picture!" ) ;
65
- } else {
62
+ if ( ! res . ok ) {
66
63
const errorMessage = await res . text ( ) ;
67
64
toast . error ( errorMessage || "Something went wrong" ) ;
65
+ return ;
68
66
}
67
+ await update ( ) ;
68
+ toast . success ( "Successfully updated your profile picture!" ) ;
69
69
} ) ;
70
70
} }
71
71
className = "rounded-lg"
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ export default async function handle(
99
99
} ,
100
100
} ) ;
101
101
102
- return res . status ( 200 ) . json ( response ) ;
102
+ return res . status ( 200 ) . json ( { message : "success" } ) ;
103
103
} catch ( error ) {
104
104
errorhandler ( error , res ) ;
105
105
}
You can’t perform that action at this time.
0 commit comments