| | |
| | | import { computed, onUnmounted } from 'vue' |
| | | import { computed, onUnmounted, ref } from 'vue' |
| | | import { defineStore } from 'pinia' |
| | | import { getDeviceList } from '@/api' |
| | | import { apiSetCurrentDevice, getDeviceList } from '@/api' |
| | | import type { SetCurrentDeviceParams } from '@/api' |
| | | import { useRequest } from 'vue-hooks-plus' |
| | | import type { Devices } from '@/api/device' |
| | | import { DEVICE_INFO_POLLING_DURATION } from '@/common/constants' |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | export const useDevicesStore = defineStore('device', () => { |
| | | const deviceInfo = computed(() => { |
| | |
| | | cancelDevicePolling() |
| | | startDevicePolling() |
| | | } |
| | | |
| | | onUnmounted(() => { |
| | | cancelDevicePolling() |
| | | }) |
| | | |
| | | return { deviceInfo, startPollingDevice } |
| | | }) |