-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'delete-account-mobile' into delete-account-backend-inte…
…gration
- Loading branch information
Showing
9 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M19 7L18.1327 19.1425C18.0579 20.1891 17.187 21 16.1378 21H7.86224C6.81296 21 5.94208 20.1891 5.86732 19.1425L5 7M10 11V17M14 11V17M15 7V4C15 3.44772 14.5523 3 14 3H10C9.44772 3 9 3.44772 9 4V7M4 7H20" stroke="#6B7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> | ||
</svg>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
import ModalLayout from '../layouts/ModalLayout'; | ||
import { Text, useTheme } from '@ui-kitten/components'; | ||
import { ALLOW_FONT_SCALLING } from '../common/constants/constants'; | ||
import { ButtonType } from '../common/enums/button-type.enum'; | ||
import { useTranslation } from 'react-i18next'; | ||
import FormLayout from '../layouts/FormLayout'; | ||
import { useDeleteAccountMutation } from '../services/user/user.service'; | ||
import { useAuth } from '../hooks/useAuth'; | ||
|
||
const DeleteAccount = ({ navigation }: any) => { | ||
const { t } = useTranslation('delete_account'); | ||
const { logout } = useAuth(); | ||
const theme = useTheme(); | ||
|
||
const { | ||
mutate: deleteAccount, | ||
isLoading: isDeletingAccount, | ||
error: deleteAccountError, | ||
} = useDeleteAccountMutation(); | ||
|
||
const onConfirmDeleteAccount = () => { | ||
deleteAccount(undefined, { | ||
onSuccess: () => { | ||
logout(); | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<ModalLayout | ||
title={t('title')} | ||
actionsOptions={{ | ||
buttonType: ButtonType.DANGER, | ||
onActionButtonClick: onConfirmDeleteAccount, | ||
actionLabel: t('confirm'), | ||
loading: isDeletingAccount, | ||
}} | ||
onDismiss={navigation.goBack} | ||
> | ||
<FormLayout> | ||
<Text allowFontScaling={ALLOW_FONT_SCALLING} category="p1"> | ||
{`${t('paragraph')}`} | ||
</Text> | ||
{!!deleteAccountError && ( | ||
<Text | ||
allowFontScaling={ALLOW_FONT_SCALLING} | ||
style={{ color: theme['color-danger-500'] }} | ||
category="p1" | ||
> | ||
{`${t('error')}`} | ||
</Text> | ||
)} | ||
</FormLayout> | ||
</ModalLayout> | ||
); | ||
}; | ||
|
||
export default DeleteAccount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters