MinhangService.js 923 Bytes
import axios from 'axios';

class MinhangService{

  constructor() {
    this.$axios = axios;
  }

  getMinhangDeviceList(params, callback, errorCallback){
    this.$axios({
      method: 'get',
      url:`/api/vehicle/query`,
      params: {
        ...params
      }
    }).then((res) => {
      if (typeof (callback) == "function") callback(res.data)
    }).catch((error) => {
      console.log(error);
      if (typeof (errorCallback) == "function") errorCallback(error)
    });
  }
  onPlay(deviceId,channel, callback, errorCallback){
    this.$axios({
      method: 'get',
      url:`/api/vehicle/onPlay`,
      params: {
        deviceId,
        channel,
      }
    }).then((res) => {
      if (typeof (callback) == "function") callback(res.data)
    }).catch((error) => {
      console.log(error);
      if (typeof (errorCallback) == "function") errorCallback(error)
    });
  }
}

export default MinhangService;