Commit 7c021b6a authored by Paul Kaplan's avatar Paul Kaplan

Catch too large thumbnails before trying to upload

parent 903eef96
...@@ -171,10 +171,14 @@ const mutateFollowingStudio = shouldFollow => ((dispatch, getState) => { ...@@ -171,10 +171,14 @@ const mutateFollowingStudio = shouldFollow => ((dispatch, getState) => {
}); });
const mutateStudioImage = input => ((dispatch, getState) => { const mutateStudioImage = input => ((dispatch, getState) => {
if (!input.files || !input.files[0]) return;
const state = getState(); const state = getState();
const studioId = selectStudioId(state); const studioId = selectStudioId(state);
const currentImage = selectStudioImage(state); const currentImage = selectStudioImage(state);
dispatch(startMutation('image')); dispatch(startMutation('image'));
if (input.files[0].size && input.files[0].size > 524288) {
return dispatch(completeMutation('image', currentImage, Errors.THUMBNAIL_TOO_LARGE));
}
const formData = new FormData(); const formData = new FormData();
formData.append('file', input.files[0]); formData.append('file', input.files[0]);
api({ api({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment