From 631eb84950cc0cc6624c7576090ebf4b7ff3b351 Mon Sep 17 00:00:00 2001 From: qschroter Date: Wed, 27 Mar 2024 17:15:30 +0100 Subject: [PATCH] add url function if needed --- src/Bones.UI/core/serviceFactory.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Bones.UI/core/serviceFactory.ts b/src/Bones.UI/core/serviceFactory.ts index d963eec..8741210 100644 --- a/src/Bones.UI/core/serviceFactory.ts +++ b/src/Bones.UI/core/serviceFactory.ts @@ -65,10 +65,12 @@ export class ServiceFactory { return { get }; } - addFetch(url: string): { fetch: () => Promise } { - + addFetch(url: string | (() => string)): { fetch: () => Promise } { + const fetch = async () => { - const response = await ServiceFactory.http.get(url); + const realUrl = typeof url === "string" ? url : url(); + + const response = await ServiceFactory.http.get(realUrl); const dto: TDetailsDTO = response.data; const result = new this.EntityDetails(dto);