Skip to content

Commit

Permalink
fix: empty image
Browse files Browse the repository at this point in the history
  • Loading branch information
Jadapema committed Dec 18, 2024
1 parent b023b3f commit 0c5fa25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/components/login-modal/profile-form-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export const ProfileFormView: React.FC<ProfileFormProps> = ({
*/
const updateProfileMetadata = useCallback(
async (data: ProfileData) => {
console.log('hello update')
setRegistrationLoading(true);

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


const profileImage =
data.profileImage instanceof File ? URL.createObjectURL(data.profileImage) : profileImagePreview;
const backgroundImage =
data.backgroundImage instanceof File ? URL.createObjectURL(data.backgroundImage) : backgroundImagePreview;

dispatch(
updateProfileData({
name: data.name,
bio: data.bio,
profileImage: profileImageURI?.replace('ipfs://', 'https://ipfs.io/ipfs/') ?? '',
backgroundImage: backgroundImageURI?.replace('ipfs://', 'https://ipfs.io/ipfs/') ?? '',
profileImage: profileImage,
backgroundImage: backgroundImage,
socialLinks: data?.socialLinks ?? [],
})
);
Expand Down
6 changes: 3 additions & 3 deletions src/redux/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const authSlice = createSlice({
action: PayloadAction<{
name: string;
bio: string;
profileImage: string;
backgroundImage: string;
profileImage?: string;
backgroundImage?: string;
socialLinks: {
twitter: string;
instagram: string;
Expand All @@ -65,7 +65,7 @@ const authSlice = createSlice({
...state.session.profile.metadata,
displayName: action.payload.name,
bio: action.payload.bio,
picture: { optimized: { uri: !!action.payload.backgroundImage ? action.payload.backgroundImage : undefined } },
picture: { optimized: { uri: !!action.payload.profileImage ? action.payload.profileImage : undefined } },
coverPicture: { optimized: { uri: !!action.payload.backgroundImage ? action.payload.backgroundImage : undefined } },
attributes: [
{ key: 'twitter', value: action.payload.socialLinks.twitter },
Expand Down

0 comments on commit 0c5fa25

Please sign in to comment.