Skip to content

Commit

Permalink
added dynamic update button disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
markgol777 committed Nov 17, 2024
1 parent 46b4dc7 commit 11779e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pages/edit-profile/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,20 @@ const EditProfile = () => {
const isTabInvalid =
errorTooltipHolders.profile || errorTooltipHolders.professionalInfo

const isPasswordSecurityTab =
activeTab === UserProfileTabsEnum.PasswordAndSecurity

const hasChanges = (
initialData: Partial<EditProfileState>,
currentData: Partial<EditProfileState>
): boolean => {
return JSON.stringify(initialData) !== JSON.stringify(currentData)
}

useEffect(() => {
console.log('isPasswordSecurityTab', isPasswordSecurityTab)
})

useEffect(() => {
const fetchData = async () => {
await dispatch(
Expand Down Expand Up @@ -211,7 +218,7 @@ const EditProfile = () => {
</Box>
<AppButton
component={Link}
disabled={!isChanged || isTabInvalid}
disabled={!isChanged || isTabInvalid || isPasswordSecurityTab}
onClick={() => void handleUpdateUser()}
size={SizeEnum.Large}
sx={styles.updateBtn}
Expand Down

0 comments on commit 11779e8

Please sign in to comment.