import { getCookie } from "cookies-next";

export default function baseRequest() {
  const token = getCookie("token");
  const accountCookie = getCookie("account");
  const account = accountCookie === undefined ? {} : JSON.parse(accountCookie);
  const mid = getCookie("mid");
  const b_ts = new Date().getTime();
  const baseRequest = {
    b_mid: mid ? parseInt(mid, 10) : account?.mid,
    b_ch: "h5",
    b_ts: b_ts,
    b_token: token,
  };
  return baseRequest;
}