Skip to content

Commit

Permalink
feat/MSSDK-2032: change or to nullish coalescence
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tewoosh committed Dec 12, 2024
1 parent 75e27d1 commit a618c1c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/components/UpdateProfile/UpdateProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,43 @@ const UpdateProfile = ({
const { t } = useTranslation();

const [detailsError, setDetailsError] = useState<string[]>([]);
const [isUserDetailsLoading, setUserDetailsLoading] = useState(false);
const [isCaptureLoading, setCaptureLoading] = useState(false);
const [isUserDetailsLoading, setIsUserDetailsLoading] = useState(false);
const [isCaptureLoading, setIsCaptureLoading] = useState(false);

const [isConsentLoading, setConsentLoading] = useState(false);

useEffect(() => {
if (!userProfile.user) {
setUserDetailsLoading(true);
setIsUserDetailsLoading(true);
getCustomer()
.then((response) => {
if (response.errors.length) {
setDetailsError(response.errors);
} else {
setCurrentUser(response.responseData);
}
setUserDetailsLoading(false);
setIsUserDetailsLoading(false);
})
.catch(() => {
setDetailsError([t('updateprofile.error', 'Something went wrong..')]);
setUserDetailsLoading(false);
setIsUserDetailsLoading(false);
});
}

if (!userProfile.capture) {
setCaptureLoading(true);
setIsCaptureLoading(true);
getCaptureStatus()
.then((response) => {
if (response.errors.length) {
setDetailsError(response.errors);
} else {
setUserCapture(response.responseData);
}
setCaptureLoading(false);
setIsCaptureLoading(false);
})
.catch(() => {
setDetailsError([t('updateprofile.error', 'Something went wrong..')]);
setCaptureLoading(false);
setIsCaptureLoading(false);
});
}

Expand Down Expand Up @@ -137,7 +137,7 @@ const UpdateProfile = ({
{innerPopup.isOpen && innerPopup.type === 'editPassword' ? (
<EditPassword
hideInnerPopup={hideInnerPopup}
customerEmail={user?.email || ''}
customerEmail={user?.email ?? ''}
handleLogout={handleLogout}
/>
) : (
Expand All @@ -150,10 +150,10 @@ const UpdateProfile = ({
) : (
<>
<ProfileDetails
firstName={user?.firstName || ''}
lastName={user?.lastName || ''}
firstName={user?.firstName ?? ''}
lastName={user?.lastName ?? ''}
capture={capture || {}}
email={user?.email || ''}
email={user?.email ?? ''}
isLoading={isUserDetailsLoading || isCaptureLoading}
setCurrentUser={setCurrentUser}
updateCaptureOption={updateCaptureOption}
Expand Down

0 comments on commit a618c1c

Please sign in to comment.