tiefen_space_h5/utils/baseRequest.js

22 lines
670 B
JavaScript

import { getCookie } from "cookies-next";
import { get } from "./storeInfo";
export default function baseRequest() {
const token = getCookie("token");
const accountCookie = get("account");
const account = accountCookie === undefined ? {} : 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,
b_did:
typeof window !== "undefined" &&
typeof window.navigator !== "undefined" &&
navigator?.userAgent.slice(0, 32),
};
// console.log("baseRequest",baseRequest)
return baseRequest;
}