make tryExecuteAndNotify wrapper more straight forward
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
export * from './resource.controller';
|
export * from './resource.controller';
|
||||||
|
export * from './tryExecuteAndNotify.method';
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { UmbControllerHostInterface } from '../controller/controller-host.mixin';
|
import { UmbControllerHostInterface } from '../controller/controller-host.mixin';
|
||||||
import type { ProblemDetails } from '../backend-api/models/ProblemDetails';
|
|
||||||
import { UmbResourceController } from './resource.controller';
|
import { UmbResourceController } from './resource.controller';
|
||||||
import { UmbNotificationOptions } from 'src/core/notification';
|
import { UmbNotificationOptions } from 'src/core/notification';
|
||||||
|
|
||||||
export async function tryExecuteAndNotify<T>(
|
export function tryExecuteAndNotify<T>(
|
||||||
host: UmbControllerHostInterface,
|
host: UmbControllerHostInterface,
|
||||||
resource: Promise<T>,
|
resource: Promise<T>,
|
||||||
options?: UmbNotificationOptions<any>
|
options?: UmbNotificationOptions<any>
|
||||||
): Promise<{ data?: T; error?: ProblemDetails }> {
|
) {
|
||||||
return await new UmbResourceController(host, resource).tryExecuteAndNotify<T>(options);
|
return new UmbResourceController(host, resource).tryExecuteAndNotify<T>(options);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user