tiefen_space_web/utils/baseRequest.js

17 lines
470 B
JavaScript
Raw Normal View History

2024-01-03 01:07:16 +08:00
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;
}