4747 </div >
4848</template >
4949
50- <script lang="ts">
51- import { defineComponent , PropType , ref } from " vue" ;
50+ <script setup lang="ts">
51+ import { PropType , ref } from " vue" ;
5252import {
5353 INotificationsError ,
5454 INotificationsSuccess ,
@@ -57,55 +57,47 @@ import { IDevice } from "@/interfaces/IDevice";
5757import { useStore } from " @/store" ;
5858import handleError from " @/utils/handleError" ;
5959
60- export default defineComponent ({
61- props: {
62- uid: {
63- type: String ,
64- required: true ,
65- },
66- device: {
67- type: Object as PropType <IDevice >,
68- required: true ,
69- },
70- notHasAuthorization: {
71- type: Boolean ,
72- default: false ,
73- },
74- style: {
75- type: [String , Object ],
76- default: undefined ,
77- },
60+ const props = defineProps ({
61+ uid: {
62+ type: String ,
63+ required: true ,
7864 },
79- emits: [" update" ],
80- setup(props , ctx ) {
81- const showDialog = ref (false );
82- const store = useStore ();
83-
84- const closeSession = async () => {
85- try {
86- await store .dispatch (" sessions/close" , {
87- uid: props .uid ,
88- device_uid: props .device .uid ,
89- });
90- showDialog .value = false ;
91- store .dispatch (
92- " snackbar/showSnackbarSuccessAction" ,
93- INotificationsSuccess .sessionClose ,
94- );
95- ctx .emit (" update" );
96- } catch (error : unknown ) {
97- store .dispatch (
98- " snackbar/showSnackbarErrorAction" ,
99- INotificationsError .sessionClose ,
100- );
101- handleError (error );
102- }
103- };
104-
105- return {
106- showDialog ,
107- closeSession ,
108- };
65+ device: {
66+ type: Object as PropType <IDevice >,
67+ required: true ,
68+ },
69+ notHasAuthorization: {
70+ type: Boolean ,
71+ default: false ,
72+ },
73+ style: {
74+ type: [String , Object ],
75+ default: undefined ,
10976 },
11077});
78+
79+ const emit = defineEmits ([" update" ]);
80+ const showDialog = ref (false );
81+ const store = useStore ();
82+
83+ const closeSession = async () => {
84+ try {
85+ await store .dispatch (" sessions/close" , {
86+ uid: props .uid ,
87+ device_uid: props .device .uid ,
88+ });
89+ showDialog .value = false ;
90+ store .dispatch (
91+ " snackbar/showSnackbarSuccessAction" ,
92+ INotificationsSuccess .sessionClose ,
93+ );
94+ emit (" update" );
95+ } catch (error : unknown ) {
96+ store .dispatch (
97+ " snackbar/showSnackbarErrorAction" ,
98+ INotificationsError .sessionClose ,
99+ );
100+ handleError (error );
101+ }
102+ };
111103 </script >
0 commit comments