@next-core/brick-kit 2.178.14 → 2.178.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -4046,6 +4046,20 @@ function isHttpAbortError(error) {
4046
4046
  return error instanceof HttpAbortError;
4047
4047
  }
4048
4048
 
4049
+ function setLoginStateCookie(location) {
4050
+ // 独立打包应用 登录时间超时后还是由前端控制跳转,后台无法处理设置登录前的 path 和 query 的 cookie 值
4051
+ // 此这场景下前端做下处理
4052
+
4053
+ var {
4054
+ search,
4055
+ pathname
4056
+ } = location;
4057
+ var pathValue = pathname ? window.btoa(encodeURIComponent(pathname)) : "";
4058
+ var searchValue = search ? window.btoa(encodeURIComponent(search)) : "";
4059
+ document.cookie = "SALOGINPATH=".concat(pathValue, "; path=/");
4060
+ document.cookie = "SALOGINQUERY=".concat(searchValue, "; path=/");
4061
+ }
4062
+
4049
4063
  /**
4050
4064
  * 将 http 请求错误转换为可读的字符串。
4051
4065
  *
@@ -4101,6 +4115,7 @@ function handleHttpError(error) {
4101
4115
  onOk: () => {
4102
4116
  var ssoEnabled = getRuntime().getFeatureFlags()["sso-enabled"];
4103
4117
  var history = getHistory();
4118
+ setLoginStateCookie(history.location);
4104
4119
  history.push(ssoEnabled ? "/sso-auth/login" : "/auth/login", {
4105
4120
  from: _objectSpread(_objectSpread({}, history.location), {}, {
4106
4121
  state: undefined
@@ -11726,6 +11741,7 @@ class Router {
11726
11741
  devtoolsHookEmit("rendering");
11727
11742
  unmountTree(mountPoints.bg);
11728
11743
  var redirectToLogin = () => {
11744
+ setLoginStateCookie(location);
11729
11745
  history.replace(_this3.kernel.getFeatureFlags()["sso-enabled"] ? "/sso-auth/login" : "/auth/login", {
11730
11746
  from: location
11731
11747
  });