fix: fix get document children

This commit is contained in:
fantasticit 2022-04-12 15:29:39 +08:00
parent 34f6456e4c
commit f7fcc71a99
2 changed files with 6 additions and 2 deletions

View File

@ -221,8 +221,11 @@ export const useCollaborationDocument = (documentId) => {
*/
export const useChildrenDocument = ({ wikiId, documentId, isShare = false }) => {
const { data, error, mutate } = useSWR<Array<IDocument>>(
isShare ? '/document/public/children' : `/document/children`,
wikiId || documentId ? (url) => HttpClient.post(url, { wikiId, documentId, isShare }) : null,
wikiId + '/' + documentId,
wikiId || documentId
? () =>
HttpClient.post(isShare ? '/document/public/children' : `/document/children`, { wikiId, documentId, isShare })
: null,
{ shouldRetryOnError: false }
);
const loading = !data && !error;

View File

@ -495,6 +495,7 @@ export class DocumentService {
if (document.isWikiHome) {
unSortDocuments = await this.documentRepo.find({
wikiId: document.wikiId,
parentDocumentId: null,
isWikiHome: false,
});
} else {