diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/modals/allowed-document-types/allowed-document-types-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/modals/allowed-document-types/allowed-document-types-modal.element.ts
index e452d5a543..663c3175c9 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/modals/allowed-document-types/allowed-document-types-modal.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/modals/allowed-document-types/allowed-document-types-modal.element.ts
@@ -1,5 +1,5 @@
import { html, nothing, customElement, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
-import { UmbTextStyles } from "@umbraco-cms/backoffice/style";
+import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UmbAllowedDocumentTypesModalData, UmbAllowedDocumentTypesModalResult } from '@umbraco-cms/backoffice/modal';
import { UmbModalBaseElement } from '@umbraco-cms/internal/modal';
import { DocumentTypeTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
@@ -48,7 +48,7 @@ export class UmbAllowedDocumentTypesModalElement extends UmbModalBaseElement<
}
private async _retrieveAllowedChildrenOfRoot() {
- const { data } = await this.#documentRepository.requestAllowedDocumentTypesAtRoot();
+ const { data } = await this.#documentRepository.requestAllowedDocumentTypesOf(null);
if (data) {
// TODO: implement pagination, or get 1000?
@@ -74,12 +74,11 @@ export class UmbAllowedDocumentTypesModalElement extends UmbModalBaseElement<
${this._allowedDocumentTypes.length === 0 ? html`No allowed types
` : nothing}
${this._allowedDocumentTypes.map(
- (item) =>
- html`
-
- ${item.icon ? html`` : nothing}
-
- `
+ (item) => html`
+
+ ${item.icon ? html`` : nothing}
+
+ `,
)}
Cancel
diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts
index 1bf8fa0e65..3a6360f9d7 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts
@@ -97,12 +97,8 @@ export class UmbDocumentRepository
}
// Structure permissions;
-
- async requestAllowedDocumentTypesAtRoot() {
- return this.#detailDataSource.getAllowedDocumentTypesAtRoot();
- }
- async requestAllowedDocumentTypesOf(id: string) {
- if (!id) throw new Error('Id is missing');
+ async requestAllowedDocumentTypesOf(id: string | null) {
+ if (id === undefined) throw new Error('Id is missing');
await this.#init;
return this.#detailDataSource.getAllowedDocumentTypesOf(id);
}
diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/sources/document.server.data.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/sources/document.server.data.ts
index 8eeefe8b9c..232a86a1ef 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/sources/document.server.data.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/sources/document.server.data.ts
@@ -45,7 +45,7 @@ export class UmbDocumentServerDataSource
this.#host,
DocumentResource.getDocumentById({
id,
- })
+ }),
);
}
@@ -142,7 +142,7 @@ export class UmbDocumentServerDataSource
headers: {
'Content-Type': 'application/json',
},
- }) as any
+ }) as any,
);
}
@@ -165,7 +165,7 @@ export class UmbDocumentServerDataSource
headers: {
'Content-Type': 'application/json',
},
- }).then((res) => res.json())
+ }).then((res) => res.json()),
);
}
@@ -175,22 +175,9 @@ export class UmbDocumentServerDataSource
* @return {*}
* @memberof UmbDocumentTypeServerDataSource
*/
- async getAllowedDocumentTypesOf(id: string) {
- if (!id) throw new Error('Id is missing');
-
+ async getAllowedDocumentTypesOf(id: string | null) {
+ if (id === undefined) throw new Error('Id is missing');
// TODO: Notice, here we need to implement pagination.
- return tryExecuteAndNotify(this.#host, DocumentResource.getDocumentByIdAllowedDocumentTypes({ id }));
- }
-
- /**
- * Get the allowed document types for root
- * @param {string} id
- * @return {*}
- * @memberof UmbDocumentTypeServerDataSource
- */
- async getAllowedDocumentTypesAtRoot() {
- console.log('source requestAllowedDocumentTypesAtRoot');
- // TODO: Notice, here we need to implement pagination.
- return tryExecuteAndNotify(this.#host, DocumentResource.getDocumentRootAllowedDocumentTypes({}));
+ return tryExecuteAndNotify(this.#host, DocumentResource.getDocumentAllowedDocumentTypes({ parentId: id }));
}
}