import { get } from "./storeInfo";
import * as Network from "expo-network";

export default async function baseRequest() {
  const appInfo = await get("app_info");
  const account = await get("account");
  const token = await get("token");
  const b_ts = new Date().getTime();
  const networkState = await Network.getNetworkStateAsync();
  const b_nt = networkState.type;
  const baseRequest = {
    b_mid: account?.mid,
    b_did: appInfo?.b_did,
    b_ver: appInfo?.b_ver,
    b_dt: appInfo?.b_dt,
    b_ch: appInfo?.b_ch,
    b_model: appInfo?.b_model,
    b_nt: b_nt,
    b_ts: b_ts,
    b_token: token,
    b_loc: {
      b_lat: null,
      b_lon: null,
    },
  };
  return baseRequest;
}
