### What problem does this PR solve? fix: fetch user by @tanstack/react-query #1306 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
29 lines
617 B
TypeScript
29 lines
617 B
TypeScript
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
|
|
import { Avatar } from 'antd';
|
|
import React from 'react';
|
|
import { history } from 'umi';
|
|
|
|
import styles from '../../index.less';
|
|
|
|
const App: React.FC = () => {
|
|
const { data: userInfo } = useFetchUserInfo();
|
|
|
|
const toSetting = () => {
|
|
history.push('/user-setting');
|
|
};
|
|
|
|
return (
|
|
<Avatar
|
|
size={32}
|
|
onClick={toSetting}
|
|
className={styles.clickAvailable}
|
|
src={
|
|
userInfo.avatar ??
|
|
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default App;
|