diff --git a/src/pages/edit-profile/EditProfile.tsx b/src/pages/edit-profile/EditProfile.tsx index 0f4bb1b2e..e757f8bb6 100644 --- a/src/pages/edit-profile/EditProfile.tsx +++ b/src/pages/edit-profile/EditProfile.tsx @@ -22,6 +22,7 @@ import { ButtonVariantEnum, SizeEnum, UpdatedPhoto, + EditProfilePhoto, UpdateUserParams, UserProfileTabsEnum, UserRole @@ -90,14 +91,14 @@ const EditProfile = () => { return JSON.stringify(initialData) !== JSON.stringify(currentData) } - const isUpdatedPhoto = (photo: string | null | UpdatedPhoto): boolean => { + const isUpdatedPhoto = (photo: EditProfilePhoto): boolean => { return photo !== null && typeof photo === 'object' && 'name' in photo } const hasPhotoChanges = useCallback( ( - initialPhoto: string | null | UpdatedPhoto, - currentPhoto: string | null | UpdatedPhoto + initialPhoto: EditProfilePhoto, + currentPhoto: EditProfilePhoto ): boolean => { if (initialPhoto !== '' && currentPhoto === '') { return true diff --git a/src/redux/features/editProfileSlice.ts b/src/redux/features/editProfileSlice.ts index 534311a5b..9e7f08218 100644 --- a/src/redux/features/editProfileSlice.ts +++ b/src/redux/features/editProfileSlice.ts @@ -13,7 +13,7 @@ import { NotificationSettings, ProfessionalBlock, SubjectNameInterface, - UpdatedPhoto, + EditProfilePhoto, UpdateUserParams, UserMainSubject, UserMainSubjectFieldValues, @@ -31,7 +31,7 @@ export interface EditProfileState { professionalSummary?: string nativeLanguage: string | null videoLink: DataByRole - photo: UpdatedPhoto | string | null + photo: EditProfilePhoto categories: DataByRole professionalBlock: ProfessionalBlock notificationSettings: NotificationSettings diff --git a/src/types/edit-profile/interfaces/editProfile.interfaces.ts b/src/types/edit-profile/interfaces/editProfile.interfaces.ts index 57c51a0d1..362f66f22 100644 --- a/src/types/edit-profile/interfaces/editProfile.interfaces.ts +++ b/src/types/edit-profile/interfaces/editProfile.interfaces.ts @@ -1,9 +1,8 @@ import { CategoryInterface, - SubjectNameInterface, - UpdatedPhoto + SubjectNameInterface } from '~/types/common/common.index' -import { UserResponse, VideoUserRole } from '~/types' +import { EditProfilePhoto, UserResponse, VideoUserRole } from '~/types' export interface EditProfileForm extends Pick { @@ -12,7 +11,7 @@ export interface EditProfileForm professionalSummary: string nativeLanguage: string | null videoLink: string - photo: UpdatedPhoto | string | null + photo: EditProfilePhoto } export interface EditProfileFormSubmitData diff --git a/src/types/edit-profile/types/editProfile.types.ts b/src/types/edit-profile/types/editProfile.types.ts index bf7bed97f..b3f5aef57 100644 --- a/src/types/edit-profile/types/editProfile.types.ts +++ b/src/types/edit-profile/types/editProfile.types.ts @@ -1,7 +1,8 @@ import { CategoryNameInterface, SubjectNameInterface, - UserMainSubject + UserMainSubject, + UpdatedPhoto } from '~/types' export type OpenProfessionalCategoryModalHandler = ( @@ -13,3 +14,5 @@ export type UserMainSubjectFieldValues = string & boolean & CategoryNameInterface & SubjectNameInterface[] + +export type EditProfilePhoto = UpdatedPhoto | string | null diff --git a/src/types/user/user-interfaces/user.interfaces.ts b/src/types/user/user-interfaces/user.interfaces.ts index 2ebd5d16d..685a213bf 100644 --- a/src/types/user/user-interfaces/user.interfaces.ts +++ b/src/types/user/user-interfaces/user.interfaces.ts @@ -6,7 +6,7 @@ import { RequestParams, Faq, DataByRole, - UpdatedPhoto, + EditProfilePhoto, UpdateFields, UserStatusEnum, UserMainSubject, @@ -78,7 +78,7 @@ export interface UpdateUserParams extends Partial> { mainSubjects?: DataByRole videoLink?: string - photo?: UpdatedPhoto | string | null + photo?: EditProfilePhoto } export interface LoginParams {