/**
 * 服务之窗APP内嵌webview，初始化一些入口参数，方便本地调试
 */

(function() {
  // 1. 设置sessionStorage 点击app端下单-导航栏-复制粘贴
  const info = {
    "href": "https://wx.palmnest.com/super_cloud/wx/appPlaceOrder/?module=canteenReserve&appChannel=placeOrders&saleId=192&v=1693385424786#/productList?saleId=192",
    "userToken": "84a069af0a99e4f7cc5cd64b71fd38d3",
    "EquipmentSN": "f9f72c49ac6f7df3",
    "token": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2OTMzNzc3MDksInN1YiI6ImFsaXRlc3Q3In0.Qkwkus7viZ3Fp2FAo81JzVLfXK6eZOeX-zUUHwBgiAg"
  }
  sessionStorage.setItem("EquipmentSN", info.EquipmentSN);
  sessionStorage.setItem("token", info.token);
  sessionStorage.setItem("userToken", info.userToken);
  sessionStorage.setItem("isNFC", "true");
})();


// 2. 设置cookie 在测试域名`wx.palmnest.com`上添加JSESSION_ID
// console.log("[init end ok]");
// JSESSION_ID: 79b65bff9f2f4d7e9faf8d070e217318
// JSESSION_IDx去掉x
// document.cookie="JSESSION_IDx=79b65bff9f2f4d7e9faf8d070e217318; Path=/;";

function getCookie() {
  return document.cookie
    .split(";")
    .map((item) => item.split("="))
    .reduce((acc, [k, v]) => (acc[k.trim().replace('"', "")] = v) && acc, {});
}

console.log(`all cookies`, getCookie());
