diff --git a/src/pages/Department/Card/DepartmentDescriptor.vue b/src/pages/Department/Card/DepartmentDescriptor.vue index e60a8c91b..70c578fc2 100644 --- a/src/pages/Department/Card/DepartmentDescriptor.vue +++ b/src/pages/Department/Card/DepartmentDescriptor.vue @@ -3,7 +3,7 @@ import { computed, ref } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; - +import { useVnConfirm } from 'composables/useVnConfirm'; import VnLv from 'src/components/ui/VnLv.vue'; import CardDescriptor from 'src/components/ui/CardDescriptor.vue'; import useCardDescription from 'src/composables/useCardDescription'; @@ -43,30 +43,17 @@ const setData = (entity) => { data.value = useCardDescription(entity.name, entity.id); }; -const removeDepartment = () => { - quasar - .dialog({ - title: 'Are you sure you want to delete it?', - message: 'Delete department', - ok: { - push: true, - color: 'primary', - }, - cancel: true, - }) - .onOk(async () => { - try { - await axios.post( - `/Departments/${entityId.value}/removeChild`, - entityId.value - ); - router.push({ name: 'WorkerDepartment' }); - notify('department.departmentRemoved', 'positive'); - } catch (err) { - console.error('Error removing department'); - } - }); +const removeDepartment = async () => { + try { + await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value); + router.push({ name: 'WorkerDepartment' }); + notify('department.departmentRemoved', 'positive'); + } catch (err) { + console.error('Error removing department'); + } }; + +const { openConfirmationModal } = useVnConfirm();