|
46 | 46 | </div> |
47 | 47 | </template> |
48 | 48 |
|
49 | | -<script lang="ts"> |
50 | | -import { defineComponent, ref } from "vue"; |
| 49 | +<script setup lang="ts"> |
| 50 | +import { ref } from "vue"; |
51 | 51 | import { |
52 | 52 | INotificationsError, |
53 | 53 | INotificationsSuccess, |
54 | 54 | } from "@/interfaces/INotifications"; |
55 | 55 | import { useStore } from "@/store"; |
56 | 56 | import handleError from "@/utils/handleError"; |
57 | 57 |
|
58 | | -export default defineComponent({ |
59 | | - props: { |
60 | | - uid: { |
61 | | - type: String, |
62 | | - required: true, |
63 | | - }, |
64 | | - notHasAuthorization: { |
65 | | - type: Boolean, |
66 | | - default: false, |
67 | | - }, |
68 | | - style: { |
69 | | - type: [String, Object], |
70 | | - default: undefined, |
71 | | - }, |
| 58 | +const props = defineProps({ |
| 59 | + uid: { |
| 60 | + type: String, |
| 61 | + required: true, |
72 | 62 | }, |
73 | | - emits: ["update"], |
74 | | - setup(props, ctx) { |
75 | | - const showDialog = ref(false); |
76 | | - const store = useStore(); |
77 | | -
|
78 | | - const deleteRecord = async () => { |
79 | | - try { |
80 | | - await store.dispatch("sessions/deleteSessionLogs", props.uid); |
81 | | - showDialog.value = false; |
82 | | - store.dispatch( |
83 | | - "snackbar/showSnackbarSuccessAction", |
84 | | - INotificationsSuccess.sessionRemoveRecord, |
85 | | - ); |
86 | | - ctx.emit("update"); |
87 | | - } catch (error: unknown) { |
88 | | - store.dispatch( |
89 | | - "snackbar/showSnackbarErrorAction", |
90 | | - INotificationsError.sessionRemoveRecord, |
91 | | - ); |
92 | | - handleError(error); |
93 | | - } |
94 | | - }; |
95 | | -
|
96 | | - return { |
97 | | - showDialog, |
98 | | - deleteRecord, |
99 | | - }; |
| 63 | + notHasAuthorization: { |
| 64 | + type: Boolean, |
| 65 | + default: false, |
| 66 | + }, |
| 67 | + style: { |
| 68 | + type: [String, Object], |
| 69 | + default: undefined, |
100 | 70 | }, |
101 | 71 | }); |
| 72 | +
|
| 73 | +const emit = defineEmits(["update"]); |
| 74 | +
|
| 75 | +const showDialog = ref(false); |
| 76 | +const store = useStore(); |
| 77 | +
|
| 78 | +const deleteRecord = async () => { |
| 79 | + try { |
| 80 | + await store.dispatch("sessions/deleteSessionLogs", props.uid); |
| 81 | + showDialog.value = false; |
| 82 | + store.dispatch( |
| 83 | + "snackbar/showSnackbarSuccessAction", |
| 84 | + INotificationsSuccess.sessionRemoveRecord, |
| 85 | + ); |
| 86 | + emit("update"); |
| 87 | + } catch (error: unknown) { |
| 88 | + store.dispatch( |
| 89 | + "snackbar/showSnackbarErrorAction", |
| 90 | + INotificationsError.sessionRemoveRecord, |
| 91 | + ); |
| 92 | + handleError(error); |
| 93 | + } |
| 94 | +}; |
102 | 95 | </script> |
0 commit comments