张涛 1 year ago
parent
commit
94449a06e8
2 changed files with 2 additions and 7 deletions
  1. 1
    1
      src/app.js
  2. 1
    6
      src/components/Auth.jsx

+ 1
- 1
src/app.js View File

7
 const App = (props) => {
7
 const App = (props) => {
8
   useEffect(() => {
8
   useEffect(() => {
9
     const userState = store.getState("user");
9
     const userState = store.getState("user");
10
-    // userState.current();
10
+    userState.current();
11
   }, []);
11
   }, []);
12
 
12
 
13
   return <Provider>{props.children}</Provider>;
13
   return <Provider>{props.children}</Provider>;

+ 1
- 6
src/components/Auth.jsx View File

16
   console.log("roles", roles);
16
   console.log("roles", roles);
17
   console.log("!roles.length || hasRights", !roles.length || hasRights);
17
   console.log("!roles.length || hasRights", !roles.length || hasRights);
18
 
18
 
19
-
20
-  const filteredChildren = React.Children.toArray(props.children).filter(
21
-    child => React.isValidElement(child)
22
-  );
23
-
24
   return !roles.length || hasRights ? (
19
   return !roles.length || hasRights ? (
25
-   <div>{filteredChildren}</div>
20
+   <div>{props.children}</div>
26
   ) : (
21
   ) : (
27
     <View
22
     <View
28
       style={{
23
       style={{