Browse Source

fix: use messge from useApp (#11497)

pull/11499/head
afc163 9 months ago
committed by GitHub
parent
commit
2765cf955d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      src/app.tsx
  2. 1606
      src/pages/User/Login/__snapshots__/login.test.tsx.snap
  3. 3
      src/pages/User/Login/index.tsx

5
src/app.tsx

@ -2,6 +2,7 @@ import { AvatarDropdown, AvatarName, Footer, Question, SelectLang } from '@/comp
import { currentUser as queryCurrentUser } from '@/services/ant-design-pro/api';
import { LinkOutlined } from '@ant-design/icons';
import type { Settings as LayoutSettings } from '@ant-design/pro-components';
import { App } from 'antd';
import { SettingDrawer } from '@ant-design/pro-components';
import type { RunTimeLayoutConfig } from '@umijs/max';
import { history, Link } from '@umijs/max';
@ -136,3 +137,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
export const request = {
...errorConfig,
};
export function rootContainer(container: React.ReactNode) {
return <App>{container}</App>;
}

1606
src/pages/User/Login/__snapshots__/login.test.tsx.snap

File diff suppressed because it is too large

3
src/pages/User/Login/index.tsx

@ -16,7 +16,7 @@ import {
ProFormText,
} from '@ant-design/pro-components';
import { FormattedMessage, Helmet, history, SelectLang, useIntl, useModel } from '@umijs/max';
import { Alert, message, Tabs } from 'antd';
import { App, Alert, Tabs } from 'antd';
import { createStyles } from 'antd-style';
import React, { useState } from 'react';
import { flushSync } from 'react-dom';
@ -100,6 +100,7 @@ const Login: React.FC = () => {
const [type, setType] = useState<string>('account');
const { initialState, setInitialState } = useModel('@@initialState');
const { styles } = useStyles();
const { message } = App.useApp();
const intl = useIntl();
const fetchUserInfo = async () => {

Loading…
Cancel
Save