feat: add loading in message box

This commit is contained in:
fantasticit 2022-04-24 20:57:43 +08:00
parent ab1dd6f05d
commit b807f73bc3
1 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import { DataRender } from 'components/data-render';
import { Empty } from 'components/empty'; import { Empty } from 'components/empty';
import { Placeholder } from './placeholder'; import { Placeholder } from './placeholder';
import styles from './index.module.scss'; import styles from './index.module.scss';
import { useUser } from 'data/user';
const { Text } = Typography; const { Text } = Typography;
const PAGE_SIZE = 6; const PAGE_SIZE = 6;
@ -82,7 +83,7 @@ const MessagesRender = ({ messageData, loading, error, onClick = null, page = 1,
); );
}; };
export const Message = () => { const MessageBox = () => {
const { data: allMsgs, loading: allLoading, error: allError, page: allPage, setPage: allSetPage } = useAllMessages(); const { data: allMsgs, loading: allLoading, error: allError, page: allPage, setPage: allSetPage } = useAllMessages();
const { const {
data: readMsgs, data: readMsgs,
@ -206,3 +207,8 @@ export const Message = () => {
</Dropdown> </Dropdown>
); );
}; };
export const Message = () => {
const { loading, error } = useUser();
return <DataRender loading={loading} error={error} normalContent={() => <MessageBox />} />;
};