Compare commits
	
		
			2 Commits
		
	
	
		
			main
			...
			feature/im
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 2519e1b4fb | ||
|   | 714e18bb65 | 
| @@ -52,11 +52,11 @@ namespace Core.Cerberos.BFF.Api.Controllers | ||||
|  | ||||
|                 if (tokenAdapter is not null && tokenAdapter.User is not null) | ||||
|                 { | ||||
|                     tokenAdapter.User.Token = tokenService.GenerateAccessToken(tokenAdapter); | ||||
|                     var (token, modules) = tokenService.GenerateAccessToken(tokenAdapter); | ||||
|  | ||||
|                     await Handle(() => cerberosServiceClient.LoginUserService(new LoginUserRequest { Email = email }, cancellationToken)).ConfigureAwait(false); | ||||
|  | ||||
|                     return Ok(tokenAdapter.User); | ||||
|                     return Ok(new { token, modules }); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Newtonsoft.Json; | ||||
| using Refit; | ||||
|  | ||||
| @@ -23,8 +24,25 @@ namespace Core.Cerberos.BFF.Api.Controllers | ||||
|  | ||||
|         private IActionResult FromAPIResponse<T>(ApiResponse<T> response) where T : class | ||||
|         { | ||||
|             var errorContent = JsonConvert.DeserializeObject<string>(response.Error?.Content ?? string.Empty) ?? string.Empty; | ||||
|             return StatusCode((int)response.StatusCode, (response.Content is not null) ? response.Content : errorContent); | ||||
|             if (response.IsSuccessful) | ||||
|                 return StatusCode((int)response.StatusCode, response.Content); | ||||
|             else | ||||
|             { | ||||
|                 dynamic errorContent = string.Empty; | ||||
|  | ||||
|                 try | ||||
|                 { | ||||
|                     errorContent = JsonConvert.DeserializeObject<string>(response.Error?.Content ?? string.Empty) ?? string.Empty; | ||||
|                 } | ||||
|                 catch (Exception) | ||||
|                 { | ||||
|                     errorContent = JsonConvert.DeserializeObject<HttpError>(response.Error?.Content); | ||||
|                     if (errorContent?.Error?.ErrorCode is null && errorContent?.Error?.Message is null && errorContent?.Error?.Target is null) | ||||
|                         errorContent = JsonConvert.DeserializeObject<GenericErrorResponse>(response.Error?.Content); | ||||
|  | ||||
|                 } | ||||
|                 return StatusCode((int)response.StatusCode, errorContent); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -7,10 +7,6 @@ | ||||
|     <GenerateDocumentationFile>True</GenerateDocumentationFile> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Core.Cerberos.Adapters" Version="0.3.0-alpha0042" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" /> | ||||
|   </ItemGroup> | ||||
|   | ||||
| @@ -7,8 +7,8 @@ | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Core.Cerberos.Adapters" Version="0.3.0-alpha0042" /> | ||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="0.9.0-alpha0001" /> | ||||
|     <PackageReference Include="BuildingBlocks.Library" Version="0.0.1" /> | ||||
|     <PackageReference Include="Cerberos.Building.Blocks" Version="0.0.3" /> | ||||
|     <PackageReference Include="Refit" Version="8.0.0" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user