Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
refactor(deleteButton): requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
carvarsou authored and cvsoult committed May 4, 2024
1 parent a7638f4 commit 55b7220
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"happy-dom": "14.7.1",
"lightningcss": "1.24.0",
"rollup-plugin-visualizer": "5.12.0",
"sass": "1.75.0",
"typescript": "5.3.3",
"unocss": "0.58.5",
"unplugin-icons": "0.18.5",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Layout/Views/ClientProfileView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
</div>
</div>
<div
style="justify-content: center; display: flex;"
@click="deleteAccountMessage">
style="justify-content: center; display: flex;">
<Boton
type="rounded-red"
class="ocial-button"
style="width: 80%; padding-top: 1vh; padding-bottom: 1vh;">
style="width: 80%; padding-top: 1vh; padding-bottom: 1vh;"
@click="deleteAccountMessage">
<div>
<p>
{{ $t('eliminarCuenta') }}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Layout/Views/UserProfileView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
</div>
</div>
<div
style="justify-content: center; display: flex;"
@click="deleteAccountMessage">
style="justify-content: center; display: flex;">
<Boton
type="rounded-red"
class="ocial-button"
style="width: 80%; padding-top: 1vh; padding-bottom: 1vh;">
style="width: 80%; padding-top: 1vh; padding-bottom: 1vh;"
@click="deleteAccountMessage">
<div>
<p>
{{ $t('eliminarCuenta') }}
Expand Down
26 changes: 11 additions & 15 deletions src/composables/use-delete-account-alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useApi } from '@/composables/apis';
export async function deleteAccountMessage() : Promise<void> {
const { t } = i18n;

await Swal.fire({
const alert = await Swal.fire({
title: t('deleteAccountMessageTitle'),
text: t('deleteAccountMessageText'),
icon: 'warning',
Expand All @@ -19,19 +19,15 @@ export async function deleteAccountMessage() : Promise<void> {
cancelButtonColor: '#0e4781',
confirmButtonText: t('deleteAccountMessageConfirm'),
cancelButtonText: t('deleteAccountMessageCancel')
}).then(async (res) => {
if (res.isConfirmed) {
await Swal.fire({
title: t('deleteAccountMessageConfirmedTitle'),
text: t('deleteAccountMessageConfirmedText'),
icon: 'success'
});
await useApi(UsersApi, 'usersMeDeleteDestroy')();
auth.logout();

return 'Account deleted';
} else {
return 'Account deletion cancelled';
}
});

if (alert.isConfirmed) {
await Swal.fire({
title: t('deleteAccountMessageConfirmedTitle'),
text: t('deleteAccountMessageConfirmedText'),
icon: 'success'
});
await useApi(UsersApi, 'usersMeDeleteDestroy')();
auth.logout();
}
}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import 'inter-ui/inter-variable.css';
import '@unocss/reset/tailwind.css';
import '@/assets/styles/global.css';
import 'virtual:uno.css';
import 'sweetalert2/src/sweetalert2.scss';
import 'sweetalert2/dist/sweetalert2.css';

/**
* - PLUGINS DE VUE Y DIRECTIVAS -
Expand Down

0 comments on commit 55b7220

Please sign in to comment.