retrieve headline

This commit is contained in:
Mads Rasmussen
2023-09-13 15:24:08 +02:00
parent eee9151a21
commit f40eec7fc8

View File

@@ -16,10 +16,13 @@ export class UmbCreateDocumentModalElement extends UmbModalBaseElement<
private _allowedDocumentTypes: DocumentTypeTreeItemResponseModel[] = [];
@state()
private _headline?: string;
private _headline: string = 'Create';
async firstUpdated() {
await this.#retrieveAllowedChildrenOf(this.data?.id || null);
const documentId = this.data?.id || null;
this.#retrieveAllowedChildrenOf(documentId);
this.#retrieveHeadline(documentId);
}
async #retrieveAllowedChildrenOf(id: string | null) {
@@ -31,6 +34,15 @@ export class UmbCreateDocumentModalElement extends UmbModalBaseElement<
}
}
async #retrieveHeadline(id: string) {
if (!id) return;
const { data } = await this.#documentRepository.requestById(id);
if (data) {
// TODO: we need to get the correct variant context here
this._headline = `Create at ${data.variants?.[0].name}`;
}
}
private _handleCancel() {
this.modalContext?.reject();
}