add data source for packages

This commit is contained in:
Jacob Overgaard
2023-02-23 16:06:34 +01:00
parent d0b075dc1a
commit e0444e27fa

View File

@@ -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())
);
}
}