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

View File

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