|
40 | 40 | </v-dialog> |
41 | 41 | </template> |
42 | 42 |
|
43 | | -<script lang="ts"> |
44 | | -import { defineComponent, computed } from "vue"; |
| 43 | +<script setup lang="ts"> |
| 44 | +import { computed } from "vue"; |
45 | 45 | import { actions, authorizer } from "@/authorizer"; |
46 | 46 | import hasPermission from "@/utils/permission"; |
47 | 47 | import { useStore } from "@/store"; |
48 | 48 |
|
49 | | -export default defineComponent({ |
50 | | - setup() { |
51 | | - const store = useStore(); |
| 49 | +const store = useStore(); |
52 | 50 |
|
53 | | - const hasAuthorization = computed(() => { |
54 | | - const role = store.getters["auth/role"]; |
55 | | - if (role !== "") { |
56 | | - return hasPermission( |
57 | | - authorizer.role[role], |
58 | | - actions.billing.subscribe, |
59 | | - ); |
60 | | - } |
| 51 | +const hasAuthorization = computed(() => { |
| 52 | + const role = store.getters["auth/role"]; |
61 | 53 |
|
62 | | - return false; |
63 | | - }); |
| 54 | + if (role !== "") { |
| 55 | + return hasPermission( |
| 56 | + authorizer.role[role], |
| 57 | + actions.billing.subscribe, |
| 58 | + ); |
| 59 | + } |
64 | 60 |
|
65 | | - const close = () => { |
66 | | - if (store.getters["users/statusUpdateAccountDialog"]) { |
67 | | - store.dispatch("users/setStatusUpdateAccountDialog", false); |
68 | | - } else if ( |
69 | | - store.getters["users/statusUpdateAccountDialogByDeviceAction"] |
70 | | - ) { |
71 | | - store.dispatch( |
72 | | - "users/setStatusUpdateAccountDialogByDeviceAction", |
73 | | - false, |
74 | | - ); |
75 | | - } |
76 | | - }; |
| 61 | + return false; |
| 62 | +}); |
| 63 | +
|
| 64 | +const close = () => { |
| 65 | + if (store.getters["users/statusUpdateAccountDialog"]) { |
| 66 | + store.dispatch("users/setStatusUpdateAccountDialog", false); |
| 67 | + } else if ( |
| 68 | + store.getters["users/statusUpdateAccountDialogByDeviceAction"] |
| 69 | + ) { |
| 70 | + store.dispatch( |
| 71 | + "users/setStatusUpdateAccountDialogByDeviceAction", |
| 72 | + false, |
| 73 | + ); |
| 74 | + } |
| 75 | +}; |
77 | 76 |
|
78 | | - const showMessage = computed({ |
79 | | - get() { |
80 | | - return ( |
81 | | - (store.getters["users/statusUpdateAccountDialog"] |
| 77 | +const showMessage = computed({ |
| 78 | + get() { |
| 79 | + return ( |
| 80 | + (store.getters["users/statusUpdateAccountDialog"] |
82 | 81 | && store.getters["stats/stats"].registered_devices === 3 |
83 | 82 | && !store.getters["billing/active"]) |
84 | 83 | || store.getters["users/statusUpdateAccountDialogByDeviceAction"] |
85 | | - ); |
86 | | - }, |
87 | | - set() { |
88 | | - close(); |
89 | | - }, |
90 | | - }); |
91 | | -
|
92 | | - return { |
93 | | - hasAuthorization, |
94 | | - showMessage, |
95 | | - close, |
96 | | - }; |
| 84 | + ); |
| 85 | + }, |
| 86 | + set() { |
| 87 | + close(); |
97 | 88 | }, |
98 | 89 | }); |
99 | 90 | </script> |
0 commit comments