"use strict";
const common_vendor = require("../common/vendor.js");
const store_index = require("../store/index.js");
store_index.Store();
function useNav() {
  const navTo = (path, token, call) => {
    if (call) {
      common_vendor.index.makePhoneCall({
        phoneNumber: "17707569278"
      });
      return;
    }
    const Authorization = common_vendor.index.getStorageSync("Authorization") || "";
    if (token && !Authorization) {
      return common_vendor.index.showModal({
        title: "提示",
        content: "你还未登录,是否前往登录?",
        success: function(res) {
          if (res.confirm) {
            common_vendor.index.navigateTo({
              url: "/pages/login/login"
            });
          } else if (res.cancel) {
            common_vendor.index.__f__("log", "at hooks/useNav.js:31", "用户点击取消");
          }
        }
      });
    } else {
      common_vendor.index.navigateTo({
        url: path
      });
    }
  };
  const nav = (e) => {
    common_vendor.index[e.type == "nav" || !e.type ? "navigateTo" : e.type == "switchTab" ? "switchTab" : "navigateTo"]({
      url: e.path
    });
  };
  return {
    nav,
    navTo
  };
}
exports.useNav = useNav;
//# sourceMappingURL=../../.sourcemap/mp-weixin/hooks/useNav.js.map
