mirror of https://github.com/fantasticit/think.git
client: update documents when need refresh
This commit is contained in:
parent
1407117eb0
commit
287fdb3a66
|
@ -292,6 +292,15 @@ export const useWikiDocuments = (wikiId) => {
|
||||||
const { data, error, isLoading, refetch } = useQuery(WikiApiDefinition.getDocumentsById.client(wikiId), () =>
|
const { data, error, isLoading, refetch } = useQuery(WikiApiDefinition.getDocumentsById.client(wikiId), () =>
|
||||||
getWikiDocuments(wikiId)
|
getWikiDocuments(wikiId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
event.on(REFRESH_TOCS, refetch);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
event.off(REFRESH_TOCS, refetch);
|
||||||
|
};
|
||||||
|
}, [refetch]);
|
||||||
|
|
||||||
return { data, loading: isLoading, error, refresh: refetch };
|
return { data, loading: isLoading, error, refresh: refetch };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { List, TabPane, Tabs, Typography } from '@douyinfe/semi-ui';
|
import { List, TabPane, Tabs } from '@douyinfe/semi-ui';
|
||||||
import { IWiki, WikiApiDefinition } from '@think/domains';
|
import { IWiki, WikiApiDefinition } from '@think/domains';
|
||||||
import { DataRender } from 'components/data-render';
|
import { DataRender } from 'components/data-render';
|
||||||
import { DocumentCard, DocumentCardPlaceholder } from 'components/document/card';
|
import { DocumentCard, DocumentCardPlaceholder } from 'components/document/card';
|
||||||
|
@ -20,8 +20,6 @@ interface IProps {
|
||||||
wikiId: string;
|
wikiId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { Title } = Typography;
|
|
||||||
|
|
||||||
const grid = {
|
const grid = {
|
||||||
gutter: 16,
|
gutter: 16,
|
||||||
xs: 24,
|
xs: 24,
|
||||||
|
|
Loading…
Reference in New Issue