| | |
| | | import { computed, onUnmounted } from 'vue' |
| | | import { computed } from 'vue' |
| | | import { defineStore } from 'pinia' |
| | | import { getDeviceList } from '@/api' |
| | | import { useRequest } from 'vue-hooks-plus' |
| | |
| | | |
| | | export const useDevicesStore = defineStore('device', () => { |
| | | const deviceInfo = computed(() => { |
| | | if (deviceInfo?.value) { |
| | | deviceRes.value.data.currentDeviceID = 'wwwwwwww222222' |
| | | } |
| | | return deviceRes?.value?.data as Devices |
| | | }) |
| | | |
| | |
| | | cancelDevicePolling() |
| | | startDevicePolling() |
| | | } |
| | | |
| | | onUnmounted(() => { |
| | | cancelDevicePolling() |
| | | }) |
| | | |
| | | return { deviceInfo, startPollingDevice } |
| | | }) |