Commit 10cbe0d5 authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

bugfix: should use useEffect

parent 4420ae2c
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
* https://github.com/ant-design/ant-design-pro-layout * https://github.com/ant-design/ant-design-pro-layout
*/ */
import { ConnectProps, ConnectState } from '@/models/connect';
import ProLayout, { import ProLayout, {
MenuDataItem, MenuDataItem,
BasicLayoutProps as ProLayoutProps, BasicLayoutProps as ProLayoutProps,
Settings, Settings,
} from '@ant-design/pro-layout'; } from '@ant-design/pro-layout';
import React, { useState } from 'react'; import React, { useEffect } from 'react';
import Authorized from '@/utils/Authorized';
import Link from 'umi/link'; import Link from 'umi/link';
import RightContent from '@/components/GlobalHeader/RightContent';
import { connect } from 'dva'; import { connect } from 'dva';
import { formatMessage } from 'umi-plugin-react/locale'; import { formatMessage } from 'umi-plugin-react/locale';
import Authorized from '@/utils/Authorized';
import RightContent from '@/components/GlobalHeader/RightContent';
import { ConnectProps, ConnectState } from '@/models/connect';
import { isAntDesignPro } from '@/utils/utils'; import { isAntDesignPro } from '@/utils/utils';
import logo from '../assets/logo.svg'; import logo from '../assets/logo.svg';
...@@ -75,7 +75,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => { ...@@ -75,7 +75,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
* constructor * constructor
*/ */
useState(() => { useEffect(() => {
if (dispatch) { if (dispatch) {
dispatch({ dispatch({
type: 'user/fetchCurrent', type: 'user/fetchCurrent',
...@@ -84,7 +84,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => { ...@@ -84,7 +84,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
type: 'settings/getSetting', type: 'settings/getSetting',
}); });
} }
}); }, []);
/** /**
* init variables * init variables
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment