tiefen_space_h5/utils/baseRequest.js

22 lines
670 B
JavaScript
Raw Normal View History

2024-07-02 15:09:48 +08:00
import { getCookie } from "cookies-next";
2024-07-06 11:05:19 +08:00
import { get } from "./storeInfo";
2024-07-02 15:09:48 +08:00
export default function baseRequest() {
const token = getCookie("token");
2024-07-06 11:05:19 +08:00
const accountCookie = get("account");
const account = accountCookie === undefined ? {} : accountCookie;
2024-07-02 15:09:48 +08:00
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,
2024-07-24 15:37:48 +08:00
b_did:
typeof window !== "undefined" &&
typeof window.navigator !== "undefined" &&
navigator?.userAgent.slice(0, 32),
2024-07-02 15:09:48 +08:00
};
2024-07-22 16:41:33 +08:00
// console.log("baseRequest",baseRequest)
2024-07-02 15:09:48 +08:00
return baseRequest;
}