I'm probably misunderstanding this. I have been using this in my new app, and so far it has been great - much better code flow.
I have one use where I get "uncaught (in promise) object".
The procedure is marked as [async] and it calls back to an interface to check a value.
I have an input and an onchange event
procedure TShopEditForm.ShopRefChange(Sender: TObject);
begin
if (DSShop.State = dsInsert) and (ShopRef.Text <> FValidatedRef) then
begin
CheckWebClient; // checks that the TXDataWebClient has been created
CheckShopRef; // this is the [async] call
end;
end;
The async call is
procedure TShopEditForm.CheckShopRef;
var
lRetval: TXDataClientResponse;
lOutcome: Boolean;
AShopRef: string;
begin
AShopRef := ShopRef.Text;
lRetval := await(TXDataClientResponse, FWebClient.RawInvokeAsync(IUTILSVC_CHECK_SHOPREF, [AShopRef]));
lOutcome := Boolean(TJSObject(lRetval.Result)['value']);
if lOutcome then
begin
FRefStatus := RefUnique;
FValidatedRef := AShopRef;
ShopRefWarningLabel.Caption := 'Ok'; //'<i class="fad fa-check"></i>';
ShopRefWarningLabel.Hint := '';
end
else
begin
FRefStatus := RefInUse;
FValidatedRef := '';
ShopRefWarningLabel.Caption := 'In use'; //'<i class="fad fa-exclamation-triangle"></i>';
ShopRefWarningLabel.Hint := 'This shop reference is already in use';
end;
end;
Can anyone put me on the right path? Thanks.