Skip to content

Commit

Permalink
rename constant to specify size type
Browse files Browse the repository at this point in the history
  • Loading branch information
manvendra-s-rathore committed May 20, 2024
1 parent ec3eb00 commit 28e15aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getRotatedImage, createImage } from './utils/canvasUtils';
import {
ACCEPTED_IMAGE_TYPES,
PROFILE_PIC_API,
PROFILE_PIC_DEFAULT_MAX_SIZE,
PROFILE_PIC_DEFAULT_MAX_SIZE_IN_MB,
} from '../../../../../constants';

const ORIENTATION_TO_ANGLE = {
Expand Down Expand Up @@ -110,7 +110,7 @@ const EditUserProfilePicture = ({ profilePictureId, form, personal, profilePictu
};

const onFileChange = async (e) => {
const maxFileSize = profilePictureMaxFileSize || PROFILE_PIC_DEFAULT_MAX_SIZE;
const maxFileSize = profilePictureMaxFileSize || PROFILE_PIC_DEFAULT_MAX_SIZE_IN_MB;
const maxFileSizeInBytes = maxFileSize * 1024 * 1024;
if (maxFileSizeInBytes && e.target.files?.length > 0) {
if (e.target.files[0].size > maxFileSizeInBytes) {
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,5 +362,5 @@ export const DCB_VIRTUAL_USER = {
type: DCB,
};

export const PROFILE_PIC_DEFAULT_MAX_SIZE = 10;
export const PROFILE_PIC_DEFAULT_MAX_SIZE_IN_MB = 10;
export const ACCEPTED_IMAGE_TYPES = 'image/jpg, image/jpeg, image/png';

0 comments on commit 28e15aa

Please sign in to comment.