mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 08:31:23 -05:00
Move max image size to constant
This commit is contained in:
parent
e2dafff5b7
commit
64ff2cffdd
1 changed files with 3 additions and 1 deletions
|
@ -24,6 +24,8 @@ const Errors = keyMirror({
|
|||
UNHANDLED: null
|
||||
});
|
||||
|
||||
const MAX_IMAGE_BYTES = 524288;
|
||||
|
||||
const getInitialState = () => ({
|
||||
mutationErrors: {}, // { [field]: <error>, ... }
|
||||
isMutating: {} // { [field]: <boolean>, ... }
|
||||
|
@ -176,7 +178,7 @@ const mutateStudioImage = input => ((dispatch, getState) => {
|
|||
const studioId = selectStudioId(state);
|
||||
const currentImage = selectStudioImage(state);
|
||||
dispatch(startMutation('image'));
|
||||
if (input.files[0].size && input.files[0].size > 524288) {
|
||||
if (input.files[0].size && input.files[0].size > MAX_IMAGE_BYTES) {
|
||||
return dispatch(completeMutation('image', currentImage, Errors.THUMBNAIL_TOO_LARGE));
|
||||
}
|
||||
const formData = new FormData();
|
||||
|
|
Loading…
Reference in a new issue