songshankun
2023-11-03 35b1ce8f65b78fcdfdd56481b29ed8d74a8a6621
src/stores/devices.ts
@@ -1,9 +1,11 @@
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(() => {
@@ -27,10 +29,6 @@
    cancelDevicePolling()
    startDevicePolling()
  }
  onUnmounted(() => {
    cancelDevicePolling()
  })
  return { deviceInfo, startPollingDevice }
})