import { defineStore, storeToRefs } from 'pinia' import { useUserStore } from './user' import { getParentBindDeviceApi } from '@/api' import { ref } from 'vue' export const useDeviceStore = defineStore('device', () => { const devices = ref([] as any) const { userInfo } = storeToRefs(useUserStore()) async function getDevices() { devices.value = ( await getParentBindDeviceApi({ parentId: userInfo.value?.id, }) )?.rows || [] return devices.value } return { devices, getDevices } })