pass dataType unique to server
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { UMB_DOCUMENT_ENTITY_TYPE, UMB_DOCUMENT_ROOT_ENTITY_TYPE } from '../entity.js';
|
||||
import type { UmbDocumentTreeItemModel } from './types.js';
|
||||
import type {
|
||||
UmbTreeAncestorsOfRequestArgs,
|
||||
UmbTreeChildrenOfRequestArgs,
|
||||
UmbTreeRootItemsRequestArgs,
|
||||
} from '@umbraco-cms/backoffice/tree';
|
||||
UmbDocumentTreeChildrenOfRequestArgs,
|
||||
UmbDocumentTreeItemModel,
|
||||
UmbDocumentTreeRootItemsRequestArgs,
|
||||
} from './types.js';
|
||||
import type { UmbTreeAncestorsOfRequestArgs } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbTreeServerDataSourceBase } from '@umbraco-cms/backoffice/tree';
|
||||
import type { DocumentTreeItemResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
import { DocumentService } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
@@ -35,17 +35,22 @@ export class UmbDocumentTreeServerDataSource extends UmbTreeServerDataSourceBase
|
||||
}
|
||||
}
|
||||
|
||||
const getRootItems = (args: UmbTreeRootItemsRequestArgs) =>
|
||||
const getRootItems = (args: UmbDocumentTreeRootItemsRequestArgs) =>
|
||||
// eslint-disable-next-line local-rules/no-direct-api-import
|
||||
DocumentService.getTreeDocumentRoot({ skip: args.skip, take: args.take });
|
||||
DocumentService.getTreeDocumentRoot({
|
||||
dataTypeId: args.dataType.unique,
|
||||
skip: args.skip,
|
||||
take: args.take,
|
||||
});
|
||||
|
||||
const getChildrenOf = (args: UmbTreeChildrenOfRequestArgs) => {
|
||||
const getChildrenOf = (args: UmbDocumentTreeChildrenOfRequestArgs) => {
|
||||
if (args.parent.unique === null) {
|
||||
return getRootItems(args);
|
||||
} else {
|
||||
// eslint-disable-next-line local-rules/no-direct-api-import
|
||||
return DocumentService.getTreeDocumentChildren({
|
||||
parentId: args.parent.unique,
|
||||
dataTypeId: args.dataType?.unique,
|
||||
skip: args.skip,
|
||||
take: args.take,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user