set data on api

This commit is contained in:
Mads Rasmussen
2024-08-15 14:23:11 +02:00
parent 918aa9360d
commit 6b51b3f11c

View File

@@ -2,6 +2,7 @@ import { UmbMemberCollectionRepository } from '../../collection/index.js';
import type { UmbMemberDetailModel } from '../../types.js';
import type { UmbMemberItemModel } from '../../repository/index.js';
import type { UmbMemberPickerModalValue, UmbMemberPickerModalData } from './member-picker-modal.token.js';
import type { PropertyValueMap } from '@umbraco-cms/backoffice/external/lit';
import { customElement, html, repeat, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbSelectionManager } from '@umbraco-cms/backoffice/utils';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
@@ -41,6 +42,13 @@ export class UmbMemberPickerModalElement extends UmbModalBaseElement<
);
}
protected override async updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>) {
super.updated(_changedProperties);
if (_changedProperties.has('data') && this.data) {
this.#api.setData(this.data);
}
}
override async firstUpdated() {
const { data } = await this.#collectionRepository.requestCollection({});
this._members = data?.items ?? [];