extend repository base for all user repositories
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { UMB_USER_STORE_CONTEXT_TOKEN, UmbUserStore } from './user.store.js';
|
||||
import { UMB_USER_ITEM_STORE_CONTEXT_TOKEN, UmbUserItemStore } from './item/user-item.store.js';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UMB_NOTIFICATION_CONTEXT_TOKEN, UmbNotificationContext } from '@umbraco-cms/backoffice/notification';
|
||||
import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository';
|
||||
|
||||
export class UmbUserRepositoryBase {
|
||||
protected host;
|
||||
export class UmbUserRepositoryBase extends UmbRepositoryBase {
|
||||
protected init;
|
||||
|
||||
protected detailStore?: UmbUserStore;
|
||||
@@ -13,20 +12,20 @@ export class UmbUserRepositoryBase {
|
||||
protected notificationContext?: UmbNotificationContext;
|
||||
|
||||
constructor(host: UmbControllerHostElement) {
|
||||
this.host = host;
|
||||
super(host);
|
||||
|
||||
this.init = Promise.all([
|
||||
new UmbContextConsumerController(this.host, UMB_USER_STORE_CONTEXT_TOKEN, (instance) => {
|
||||
this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (instance) => {
|
||||
this.detailStore = instance;
|
||||
}).asPromise(),
|
||||
|
||||
new UmbContextConsumerController(this.host, UMB_USER_ITEM_STORE_CONTEXT_TOKEN, (instance) => {
|
||||
this.consumeContext(UMB_USER_ITEM_STORE_CONTEXT_TOKEN, (instance) => {
|
||||
this.itemStore = instance;
|
||||
}).asPromise(),
|
||||
|
||||
new UmbContextConsumerController(this.host, UMB_NOTIFICATION_CONTEXT_TOKEN, (instance) => {
|
||||
this.consumeContext(UMB_NOTIFICATION_CONTEXT_TOKEN, (instance) => {
|
||||
this.notificationContext = instance;
|
||||
}).asPromise(),
|
||||
}).asPromise()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user