Skip to content

Commit 0c5fa25

Browse files
committed
fix: empty image
1 parent b023b3f commit 0c5fa25

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/components/login-modal/profile-form-view.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export const ProfileFormView: React.FC<ProfileFormProps> = ({
132132
*/
133133
const updateProfileMetadata = useCallback(
134134
async (data: ProfileData) => {
135-
console.log('hello update')
136135
setRegistrationLoading(true);
137136

138137
dispatch(setIsUpdatingMetadata(true));
@@ -154,12 +153,18 @@ export const ProfileFormView: React.FC<ProfileFormProps> = ({
154153
// Upload metadata to IPFS
155154
const metadataURI = await uploadMetadataToIPFS(metadata);
156155

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+
157162
dispatch(
158163
updateProfileData({
159164
name: data.name,
160165
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,
163168
socialLinks: data?.socialLinks ?? [],
164169
})
165170
);

src/redux/auth/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ const authSlice = createSlice({
4848
action: PayloadAction<{
4949
name: string;
5050
bio: string;
51-
profileImage: string;
52-
backgroundImage: string;
51+
profileImage?: string;
52+
backgroundImage?: string;
5353
socialLinks: {
5454
twitter: string;
5555
instagram: string;
@@ -65,7 +65,7 @@ const authSlice = createSlice({
6565
...state.session.profile.metadata,
6666
displayName: action.payload.name,
6767
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 } },
6969
coverPicture: { optimized: { uri: !!action.payload.backgroundImage ? action.payload.backgroundImage : undefined } },
7070
attributes: [
7171
{ key: 'twitter', value: action.payload.socialLinks.twitter },

0 commit comments

Comments
 (0)