File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
apps/web/app/(org)/dashboard/settings/account Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -116,13 +116,16 @@ export const Settings = ({
116116 } ) ;
117117
118118 const removeProfileImageMutation = useMutation ( {
119- mutationFn : ( ) => removeImage ( user ?. image || "" , "user" , user ?. id || "" ) ,
120- onSuccess : ( result ) => {
121- if ( result ?. success ) {
122- setProfileImageOverride ( null ) ;
123- toast . success ( "Profile image removed" ) ;
124- router . refresh ( ) ;
119+ mutationFn : ( ) => {
120+ if ( ! user ?. id ) {
121+ throw new Error ( "User ID is required" ) ;
125122 }
123+ return removeImage ( user . image || "" , "user" , user . id ) ;
124+ } ,
125+ onSuccess : ( ) => {
126+ setProfileImageOverride ( null ) ;
127+ toast . success ( "Profile image removed" ) ;
128+ router . refresh ( ) ;
126129 } ,
127130 onError : ( error ) => {
128131 console . error ( "Error removing profile image:" , error ) ;
You can’t perform that action at this time.
0 commit comments