import {
  GET_REALTIME_DIST_API,
  GET_ELECUSE_DAY_API,
  GET_TAI_POWER_API,
} from "./api";
import instance from "@/util/request";
import apihandler from "@/util/apihandler";

export const getRealTimeDist = async () => {
  const res = await instance.post(GET_REALTIME_DIST_API);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
};

export const getElecUseDay = async () => {
  const res = await instance.post(GET_ELECUSE_DAY_API);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
};

export const getTaipower = async () => {
  const res = await instance.post(GET_TAI_POWER_API);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
};