react-toolkits 2.11.7 → 2.11.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.11.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 5241a1b: fix: missing Navigate
8
+
9
+ ## 2.11.8
10
+
11
+ ### Patch Changes
12
+
13
+ - ec15f55: fix: missing 'signInPath' in ToolkitsProvider
14
+
3
15
  ## 2.11.7
4
16
 
5
17
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -487,7 +487,7 @@ type JsonData<T = any> = {
487
487
  };
488
488
  declare const Interceptor: ({ children }: {
489
489
  children?: ReactNode;
490
- }) => string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
490
+ }) => ReactNode;
491
491
 
492
492
  declare const mixedStorage: StateStorage;
493
493
 
package/lib/index.js CHANGED
@@ -4,14 +4,14 @@ import { create, useStore, createStore } from 'zustand';
4
4
  import { persist, createJSONStorage } from 'zustand/middleware';
5
5
  import * as Antd2 from 'antd';
6
6
  import { Spin, Menu, Modal, Form, App, theme, Space, Input, Tag, Typography, Result, Table, Button, Empty, Dropdown, Divider, Card, Select, Alert, Switch, InputNumber, Row, Col, Breadcrumb, Skeleton, Descriptions, Tooltip, Popconfirm, Collapse, Checkbox } from 'antd';
7
- import { useLocation, Routes, Route, Navigate, Link, useNavigate, useParams } from 'react-router-dom';
8
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
7
  import { memo, useMemo, useCallback, useEffect, lazy, useContext, useState, useRef, Fragment as Fragment$1, Suspense, createContext, forwardRef, useImperativeHandle, cloneElement } from 'react';
10
8
  import useSWR5, { mutate, SWRConfig, unstable_serialize } from 'swr';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
10
  import { has, template, get, isEqual } from 'lodash-es';
12
11
  import { flushSync } from 'react-dom';
13
12
  import { createRoot } from 'react-dom/client';
14
13
  import useSWRMutation2 from 'swr/mutation';
14
+ import { useLocation, Routes, Route, Navigate, Link, useNavigate, useParams } from 'react-router-dom';
15
15
  import { Editor } from '@monaco-editor/react';
16
16
  import { PlusOutlined, LogoutOutlined, UserOutlined, MenuUnfoldOutlined, MenuFoldOutlined, UserAddOutlined, UsergroupAddOutlined } from '@ant-design/icons';
17
17
  import { produce } from 'immer';
@@ -284,7 +284,8 @@ var init_axios = __esm({
284
284
  const state = useToolkitsStore((s) => s);
285
285
  const { notification } = App.useApp();
286
286
  if (!state.token) {
287
- return /* @__PURE__ */ jsx(Navigate, { to: state.signInPath });
287
+ window.location.replace(state.signInPath);
288
+ return null;
288
289
  }
289
290
  if (requestInterceptorId) {
290
291
  axiosInstance.interceptors.request.eject(requestInterceptorId);
@@ -382,14 +383,14 @@ var init_Provider = __esm({
382
383
  ToolkitsContext = createContext(null);
383
384
  ToolkitsProvider = (props) => {
384
385
  const { children, ...restProps } = props;
385
- if (!restProps.signInPath) {
386
- throw new Error('ToolkitsProvider: \u8BF7\u914D\u7F6E "signInPath"');
387
- }
388
386
  const storeRef = useRef();
389
387
  if (!storeRef.current) {
390
388
  storeRef.current = createToolkitsStore({ ...globalState, ...restProps });
391
389
  }
392
390
  globalState = storeRef.current.getState();
391
+ if (!globalState.signInPath) {
392
+ throw new Error('ToolkitsProvider: \u8BF7\u914D\u7F6E "signInPath"');
393
+ }
393
394
  return /* @__PURE__ */ jsx(ToolkitsContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsx(App, { children: /* @__PURE__ */ jsx(
394
395
  SWRConfig,
395
396
  {