The errors here (constant object cannot ...) are on all "await" calls. e.g. in DoLogin:
public
property currentPerson: TAuthenticatedUser read FcurrentPerson write FcurrentPerson;
procedure ClearStorage;
[async]
function DoLogin(AEmail: string; APassword: string; APlatform: string): TJSXMLHttpRequest;
function TAuthorisation.DoLogin(AEmail, APassword, APlatform: string): TJSXMLHttpRequest;
var
req: TJSXMLHttpRequest;
jsObj, userObj: TJSObject;
userID: string;
begin
SetRequest('/login', httpPOST, Format('{"email": "%s","password": "%s", "platform": "%s"}', [AEmail, APassword, APlatform]));
req := await(TJSXMLHttpRequest, PerformRequestWithCredentials(WebHttpRequest1));
SetCurrentUser(req.response);
Result := req;
end;
Another error (Invalid TypeCats) is here on both typecasts e.g.:
procedure TAuthorisation.SetCurrentUser(AJSValue: TJSValue);
var
jsObj: TJSObject;
Roles: TJSArray;
i: Integer;
begin
jsObj := TJSObject(AJSValue);
jsObj := TJSObject(jsObj['authenticatedUser']);
...
Really annoying: it compiles, but coding is not pleasant in this way...
Any solution?
Regards,
Filip