add data source for packages
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/resources';
|
||||
import { umbracoPath } from '@umbraco-cms/utils';
|
||||
|
||||
/**
|
||||
* Data source for packages from the server
|
||||
* @export
|
||||
*/
|
||||
export class UmbPackageServerDataSource {
|
||||
constructor(private readonly host: UmbControllerHostInterface) {}
|
||||
|
||||
/**
|
||||
* Get the root items from the server
|
||||
* @memberof UmbPackageServerDataSource
|
||||
*/
|
||||
getRootItems() {
|
||||
return tryExecuteAndNotify(
|
||||
this.host,
|
||||
fetch(umbracoPath('/manifests')).then((res) => res.json())
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user