import axios from 'axios'
import request from '@/utils/request'
import { getToken } from '@/utils/auth'

// 硬件数据统计
export function getHardData() {
  return request({
    url: '/mq/open',
    method: 'get'
  })
}

// 注册用户统计
export function getSignUser() {
  return request({
    url: '/user/count',
    method: 'get'
  })
}

// 硬件数据统计
export function setUpConnection() {
  return new Promise((resolve, reject) => {
    axios({
      url: '/mq/connection',
      method: 'get',
      baseURL: process.env.BASE_API,
      timeout: 10000,
      headers: {
        'X-Auth-Token': getToken(),
        'Login-Type': 'web'
      }
    }).then(response => {
      resolve(response.data)
    }).catch(e => reject(e))
  })
}

