add user-group store
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { BehaviorSubject, map, Observable } from 'rxjs';
|
||||
import type { UserDetails, UserEntity, UserGroupDetails } from '../../models';
|
||||
import { UmbEntityStore } from '../entity.store';
|
||||
import { UmbDataStoreBase } from '../store';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @class UmbUserGroupStore
|
||||
* @extends {UmbDataStoreBase<UserGroupEntity>}
|
||||
* @description - Data Store for Users
|
||||
*/
|
||||
export class UmbUserGroupStore extends UmbDataStoreBase<UserGroupDetails> {
|
||||
private _entityStore: UmbEntityStore;
|
||||
|
||||
constructor(entityStore: UmbEntityStore) {
|
||||
super();
|
||||
this._entityStore = entityStore;
|
||||
}
|
||||
|
||||
getAll(): Observable<Array<UserGroupDetails>> {
|
||||
// TODO: use Fetcher API.
|
||||
// TODO: only fetch if the data type is not in the store?
|
||||
fetch(`/umbraco/backoffice/user-groups/list/items`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
this.update(data.items);
|
||||
});
|
||||
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user