2023-01-02 14:55:46 +01:00
|
|
|
import { UmbControllerHostInterface } from "../controller/controller-host.mixin";
|
2023-01-02 15:07:25 +01:00
|
|
|
import type { ProblemDetails } from "../backend-api/models/ProblemDetails";
|
2023-01-02 14:55:46 +01:00
|
|
|
import { UmbResourceController } from "./resource.controller";
|
|
|
|
|
import { UmbNotificationOptions } from "src/backoffice/core/services/notification";
|
|
|
|
|
|
|
|
|
|
export async function tryExecuteAndNotify<T>(host:UmbControllerHostInterface, resource:Promise<T>, options?: UmbNotificationOptions<any>): Promise<{data?: T, error?:ProblemDetails}> {
|
|
|
|
|
return await new UmbResourceController(host, resource).tryExecuteAndNotify<T>(options);
|
|
|
|
|
}
|