"use strict";
const common_vendor = require("./common/vendor.js");
const store_user = require("./store/user.js");
const settings_enums = require("./settings/enums.js");
const loginList = [];
const navigateToInterceptor = {
  invoke({ url }) {
    const userStore = store_user.useUserStore();
    const getToken = common_vendor.computed(() => userStore.getToken);
    const path = url.split("?")[0];
    if (common_vendor.unref(getToken))
      return true;
    common_vendor.index.__f__("log", "at routeInterceptor.js:16", "出发前", path, loginList.includes(path));
    if (loginList.includes(path)) {
      common_vendor.index.showModal({
        title: "提示",
        content: "未登录请先登录",
        success: function(res) {
          if (res.confirm) {
            common_vendor.index.setStorageSync(settings_enums.REDIRECT_KEY, url);
          } else if (res.cancel)
            ;
        }
      });
      return false;
    }
    return true;
  },
  success(args) {
    common_vendor.index.__f__("log", "at routeInterceptor.js:33", "成功", args);
  },
  fail(err) {
    common_vendor.index.__f__("log", "at routeInterceptor.js:36", "失败", err);
  }
};
const routeInterceptor = {
  install() {
    common_vendor.index.addInterceptor("navigateTo", navigateToInterceptor);
    common_vendor.index.addInterceptor("reLaunch", navigateToInterceptor);
    common_vendor.index.addInterceptor("redirectTo", navigateToInterceptor);
  }
};
exports.routeInterceptor = routeInterceptor;
//# sourceMappingURL=../.sourcemap/mp-weixin/routeInterceptor.js.map
