Fix Image
This commit is contained in:
@@ -60,14 +60,19 @@ class ApiImpl {
|
||||
};
|
||||
|
||||
public updateUser = async (data: UserUpdate, id?: number): Promise<User> => {
|
||||
return await (await this.patch(`users/${id ?? 'self'}`, data as Record<string, unknown>)).json();
|
||||
const user = await (await this.patch(`users/${id ?? 'self'}`, data as Record<string, unknown>)).json();
|
||||
this.self = user;
|
||||
return user;
|
||||
};
|
||||
|
||||
public updateUserImage = async (data: UserImageUpdate, id?: number): Promise<User> => {
|
||||
const formData = new FormData();
|
||||
if (data.image) formData.append('image', data.image);
|
||||
if (!data.image && data.predefined) formData.append('predefined', data.predefined);
|
||||
return await (await this.postAuthRaw(`users/${id ?? 'self'}/image`, formData)).json();
|
||||
|
||||
const user = await (await this.postAuthRaw(`users/${id ?? 'self'}/image`, formData)).json();
|
||||
this.self = user;
|
||||
return user;
|
||||
};
|
||||
|
||||
public newPost = async (data: PostUpdate): Promise<PostNew> => {
|
||||
|
||||
@@ -37,7 +37,7 @@ const Profile: FC<Props> = ({ user, canEdit }) => {
|
||||
<Grid container spacing={2}>
|
||||
<Grid item sx={{ display: 'flex', flexGrow: 1, justifyContent: 'center' }}>
|
||||
<IconButton onClick={() => setImageOpen(true)}>
|
||||
<Avatar alt={user.username} src={`storage/>${user.image}`} sx={{ width: '100px', height: '100px' }}>
|
||||
<Avatar alt={user.username} src={`storage/${user.image}`} sx={{ width: '100px', height: '100px' }}>
|
||||
<Person sx={{ width: '60px', height: '60px' }} />
|
||||
</Avatar>
|
||||
</IconButton>
|
||||
|
||||
Reference in New Issue
Block a user