Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #835 from SE-TINF22B6/frontend
Browse files Browse the repository at this point in the history
Quick fix: Profile picture service
  • Loading branch information
maxschwinghammer authored Jun 5, 2024
2 parents da3c260 + 6322d61 commit c4db5a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/web/src/services/ProfilePictureService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const fetchUserImage = async (setUserImage: (data: any) => void): Promise<void>
});
if (response.ok) {
const data = await response.json();
setUserImage(data);
setUserImage(data.imageData);
} else {
console.log(new Error("Failed to fetch user image"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('fetchUserImage', (): void => {
});

it('should fetch user image successfully when user is logged in', async (): Promise<void> => {
const mockData = { image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz3' };
const mockData = { imageData: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz3' };
const mockResponse = {
ok: true,
json: jest.fn().mockResolvedValue(mockData),
Expand All @@ -41,7 +41,7 @@ describe('fetchUserImage', (): void => {
'Authorization': 'Bearer mock-jwt',
},
});
expect(setUserImage).toHaveBeenCalledWith(mockData);
expect(setUserImage).toHaveBeenCalledWith(mockData.imageData);
});

it('should not fetch user image if user is not logged in', async (): Promise<void> => {
Expand Down

0 comments on commit c4db5a3

Please sign in to comment.