MobilaApp fixes

This commit is contained in:
jozsef.b@aycode.com 2024-03-28 20:19:23 +01:00
parent a3ba12046a
commit 5d4abbc220
2 changed files with 16 additions and 6 deletions

View File

@ -44,13 +44,13 @@ namespace TIAMMobileApp.Services
public async Task<UserSessionModel> IsLoggedInAsync(Guid id)
{
var dbUser = await GetUserByIdAsync(id);
var userModelDto = await GetUserByIdAsync(id);
if (dbUser != null)
if (userModelDto != null)
{
var hasProperties = await _serviceProviderDataService.GetPropertiesByOwnerIdAsync(dbUser.Id);
var user = new UserSessionModel(dbUser.Id, UserType.User, dbUser.Profile?.Name, hasProperties, 1);
var hasProperties = await _serviceProviderDataService.GetPropertiesByOwnerIdAsync(userModelDto.Id);
var user = new UserSessionModel(userModelDto.Id, UserType.User, userModelDto, hasProperties, 1);
return user;
}
@ -127,9 +127,16 @@ namespace TIAMMobileApp.Services
{
return await http.GetFromJsonAsync<UserModelDto?>(APIUrls.GetUserByEmail);
}
public async Task<User?> GetUserByIdAsync(Guid Id)
public async Task<UserModelDto?> GetUserByIdAsync(Guid id)
{
return await http.GetFromJsonAsync<User?>(APIUrls.GetUserById);
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetUserById}";
//logToBrowserConsole.LogToBC("GetUserByIdAsync url: " + url + ", " + id.ToString());
var response = await http.PostAsJsonAsync(url, id);
var result = await response.Content.ReadAsStringAsync();
var user = JsonConvert.DeserializeObject<UserModelDto>(result);
return user;
}
public async Task<bool> RefreshToken()

View File

@ -77,6 +77,9 @@
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>