Fixed bugs in Web.Bff.Shopping aggregator project
This commit is contained in:
parent
f1c0db1118
commit
b0576ee9b8
@ -124,7 +124,7 @@ public class BasketController : ControllerBase
|
|||||||
//item.PictureUri =
|
//item.PictureUri =
|
||||||
|
|
||||||
// Step 2: Get current basket status
|
// Step 2: Get current basket status
|
||||||
var currentBasket = (await _basket.GetById(data.BasketId)) ?? new BasketData(data.BasketId);
|
var currentBasket = (await _basket.GetByIdAsync(data.BasketId)) ?? new BasketData(data.BasketId);
|
||||||
// Step 3: Search if exist product into basket
|
// Step 3: Search if exist product into basket
|
||||||
var product = currentBasket.Items.SingleOrDefault(i => i.ProductId == item.Id);
|
var product = currentBasket.Items.SingleOrDefault(i => i.ProductId == item.Id);
|
||||||
if (product != null)
|
if (product != null)
|
||||||
|
@ -20,7 +20,7 @@ public class OrderController : ControllerBase
|
|||||||
[ProducesResponseType(typeof(OrderData), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(OrderData), (int)HttpStatusCode.OK)]
|
||||||
public async Task<ActionResult<OrderData>> GetOrderDraftAsync(string basketId)
|
public async Task<ActionResult<OrderData>> GetOrderDraftAsync(string basketId)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhitespace(basketId))
|
if (string.IsNullOrWhiteSpace(basketId))
|
||||||
{
|
{
|
||||||
return BadRequest("Need a valid basketid");
|
return BadRequest("Need a valid basketid");
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public class HttpClientAuthorizationDelegatingHandler
|
|||||||
var authorizationHeader = _httpContextAccessor.HttpContext
|
var authorizationHeader = _httpContextAccessor.HttpContext
|
||||||
.Request.Headers["Authorization"];
|
.Request.Headers["Authorization"];
|
||||||
|
|
||||||
if (!string.IsNullOrWhitespace(authorizationHeader))
|
if (!string.IsNullOrWhiteSpace(authorizationHeader))
|
||||||
{
|
{
|
||||||
request.Headers.Add("Authorization", new List<string>() { authorizationHeader });
|
request.Headers.Add("Authorization", new List<string>() { authorizationHeader });
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class BasketService : IBasketService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<BasketData> GetById(string id)
|
public async Task<BasketData> GetByIdAsync(string id)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("grpc client created, request = {@id}", id);
|
_logger.LogDebug("grpc client created, request = {@id}", id);
|
||||||
var response = await _basketClient.GetBasketByIdAsync(new BasketRequest { Id = id });
|
var response = await _basketClient.GetBasketByIdAsync(new BasketRequest { Id = id });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user