File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,6 @@ export const ProfileFormView: React.FC<ProfileFormProps> = ({
132
132
*/
133
133
const updateProfileMetadata = useCallback (
134
134
async ( data : ProfileData ) => {
135
- console . log ( 'hello update' )
136
135
setRegistrationLoading ( true ) ;
137
136
138
137
dispatch ( setIsUpdatingMetadata ( true ) ) ;
@@ -154,12 +153,18 @@ export const ProfileFormView: React.FC<ProfileFormProps> = ({
154
153
// Upload metadata to IPFS
155
154
const metadataURI = await uploadMetadataToIPFS ( metadata ) ;
156
155
156
+
157
+ const profileImage =
158
+ data . profileImage instanceof File ? URL . createObjectURL ( data . profileImage ) : profileImagePreview ;
159
+ const backgroundImage =
160
+ data . backgroundImage instanceof File ? URL . createObjectURL ( data . backgroundImage ) : backgroundImagePreview ;
161
+
157
162
dispatch (
158
163
updateProfileData ( {
159
164
name : data . name ,
160
165
bio : data . bio ,
161
- profileImage : profileImageURI ?. replace ( 'ipfs://' , 'https://ipfs.io/ipfs/' ) ?? '' ,
162
- backgroundImage : backgroundImageURI ?. replace ( 'ipfs://' , 'https://ipfs.io/ipfs/' ) ?? '' ,
166
+ profileImage : profileImage ,
167
+ backgroundImage : backgroundImage ,
163
168
socialLinks : data ?. socialLinks ?? [ ] ,
164
169
} )
165
170
) ;
Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ const authSlice = createSlice({
48
48
action : PayloadAction < {
49
49
name : string ;
50
50
bio : string ;
51
- profileImage : string ;
52
- backgroundImage : string ;
51
+ profileImage ? : string ;
52
+ backgroundImage ? : string ;
53
53
socialLinks : {
54
54
twitter : string ;
55
55
instagram : string ;
@@ -65,7 +65,7 @@ const authSlice = createSlice({
65
65
...state . session . profile . metadata ,
66
66
displayName : action . payload . name ,
67
67
bio : action . payload . bio ,
68
- picture : { optimized : { uri : ! ! action . payload . backgroundImage ? action . payload . backgroundImage : undefined } } ,
68
+ picture : { optimized : { uri : ! ! action . payload . profileImage ? action . payload . profileImage : undefined } } ,
69
69
coverPicture : { optimized : { uri : ! ! action . payload . backgroundImage ? action . payload . backgroundImage : undefined } } ,
70
70
attributes : [
71
71
{ key : 'twitter' , value : action . payload . socialLinks . twitter } ,
You can’t perform that action at this time.
0 commit comments