0
0
Fork 0

passwordAccount

This commit is contained in:
Carlos Satorres 2024-07-26 09:09:38 +02:00
parent 8b2b618d35
commit 2f617f4b92
3 changed files with 44 additions and 19 deletions

View File

@ -8,7 +8,7 @@ import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import useNotify from 'src/composables/useNotify.js';
const quasar = useQuasar();
const $props = defineProps({
hasAccount: {
@ -21,7 +21,7 @@ const { t } = useI18n();
const { hasAccount } = toRefs($props);
const { openConfirmationModal } = useVnConfirm();
const route = useRoute();
const { notify } = useNotify();
const account = computed(() => useArrayData('AccountId').store.data[0]);
account.value.hasAccount = hasAccount.value;
const entityId = computed(() => +route.params.id);
@ -71,9 +71,44 @@ async function sync() {
type: 'positive',
});
}
// const removeAccount = async () => {
// try {
// quasar
// .dialog({
// component: VnConfirm,
// componentProps: {
// title: t('account.card.actions.delete.title'),
// message: t('account.card.actions.delete.subTitle'),
// promise: async () => {
// try {
// await axios.delete(`VnUsers/${this.id}`);
// notify('Account removed', 'positive');
// } catch (error) {
// notify('Error removing account', 'negative');
// console.error('Error deleting the account', error);
// }
// },
// },
// })
// .onOk(() => {
// notify('Account removed', 'positive');
// });
// } catch (error) {
// console.error('Error deleting the account', error);
// }
// };
const removeAccount = async () => {
try {
console.log('id', account.value.id);
await axios.delete(`VnUsers/${account.value.id}`);
notify(t('Account removed'), 'positive');
} catch (error) {
console.error('Error killing session', error);
}
};
</script>
<template>
<VnConfirm
<!-- <VnConfirm
v-model="showSyncDialog"
:message="t('account.card.actions.sync.message')"
:title="t('account.card.actions.sync.title')"
@ -102,8 +137,8 @@ async function sync() {
type="password"
/>
</template>
</VnConfirm>
<QItem v-ripple clickable @click="setPassword">
</VnConfirm> -->
<!-- <QItem v-ripple clickable @click="setPassword">
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
</QItem>
<QItem
@ -119,7 +154,7 @@ async function sync() {
"
>
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
</QItem>
</QItem> -->
<QItem
v-if="account.hasAccount"
v-ripple
@ -168,17 +203,7 @@ async function sync() {
</QItem>
<QSeparator />
<QItem
@click="
openConfirmationModal(
t('account.card.actions.delete.title'),
t('account.card.actions.delete.subTitle'),
removeAccount
)
"
v-ripple
clickable
>
<QItem @click="removeAccount(id)" v-ripple clickable>
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>

View File

@ -68,7 +68,7 @@ account:
delete:
name: Delete
title: The account will be deleted
subtitle: Are you sure you want to continue?
subTitle: Are you sure you want to continue?
success: ''
search: Search user
searchInfo: You can search by id, name or nickname

View File

@ -67,7 +67,7 @@ account:
delete:
name: Eliminar
title: El usuario será eliminado
subtitle: ¿Seguro que quieres continuar?
subTitle: ¿Seguro que quieres continuar?
success: ''
search: Buscar usuario
searchInfo: Puedes buscar por id, nombre o usuario