Skip to content

Commit

Permalink
Fixed issues with uploads (profile, presentation, branding) (#5590)
Browse files Browse the repository at this point in the history
  • Loading branch information
farhatahmad authored Nov 29, 2023
1 parent af2b0ed commit b82f8ef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/admin/site_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def index
render_data data: site_settings, status: :ok
end

# GET /api/v1/admin/site_settings/:name.json
# PATCH /api/v1/admin/site_settings/:name.json
# Updates the value of the specified Site Setting
def update
site_setting = SiteSetting.joins(:setting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export default function useUpdateSiteSetting(name) {
settings = data;
}

return axios.patch(`/admin/site_settings/${name}.json`, settings);
return axios.patch(`/admin/site_settings/${name}.json`, settings, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
};

const handleSuccess = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export default function useUploadPresentation(friendlyId) {
fileValidation(presentation, 'presentation');
const formData = new FormData();
formData.append('room[presentation]', presentation);
return axios.patch(`/rooms/${friendlyId}.json`, formData);
return axios.patch(`/rooms/${friendlyId}.json`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
};

const mutation = useMutation(uploadPresentation, {
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/hooks/mutations/users/useCreateAvatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export default function useCreateAvatar(currentUser) {
});
const formData = new FormData();
formData.append('user[avatar]', avatarBlob);
return axios.patch(`/users/${currentUser.id}.json`, formData);
return axios.patch(`/users/${currentUser.id}.json`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}

const mutation = useMutation(
Expand Down

0 comments on commit b82f8ef

Please sign in to comment.