fix(web-client-tpos): fix kitchen/recipes BFF routes — SPA fallback intercepted short routes

Changed BFF routes to use shops/{shopId}/ prefix pattern:
- kitchen/tickets → shops/{shopId}/kitchen-tickets
- recipes → shops/{shopId}/recipes
Updated PosDataService client URLs to match.
Added missing kitchen/recipes data loading cases in ShopPage.
This commit is contained in:
Ho Ngoc Hai
2026-03-04 07:52:45 +07:00
parent d9fda3f54f
commit 6548b5babf
2 changed files with 8 additions and 8 deletions

View File

@@ -529,9 +529,8 @@ public class PosDataService
public async Task<List<KitchenTicketInfo>> GetKitchenTicketsAsync(Guid? shopId = null, string status = "pending")
{
AttachToken();
var url = shopId.HasValue
? $"api/bff/kitchen/tickets?shopId={shopId}&status={status}"
: $"api/bff/kitchen/tickets?status={status}";
if (!shopId.HasValue) return new();
var url = $"api/bff/shops/{shopId}/kitchen-tickets?status={status}";
return await _http.GetFromJsonAsync<List<KitchenTicketInfo>>(url, _jsonOptions) ?? new();
}
@@ -548,7 +547,8 @@ public class PosDataService
public async Task<List<RecipeInfo>> GetRecipesAsync(Guid? shopId = null)
{
AttachToken();
var url = shopId.HasValue ? $"api/bff/recipes?shopId={shopId}" : "api/bff/recipes";
if (!shopId.HasValue) return new();
var url = $"api/bff/shops/{shopId}/recipes";
return await _http.GetFromJsonAsync<List<RecipeInfo>>(url, _jsonOptions) ?? new();
}

View File

@@ -1682,8 +1682,8 @@ public class BffDataController : ControllerBase
// ═══ KITCHEN TICKETS (fnb_engine) ═══
[HttpGet("kitchen/tickets")]
public async Task<IActionResult> GetKitchenTickets([FromQuery] Guid? shopId = null, [FromQuery] string status = "pending")
[HttpGet("shops/{shopId}/kitchen-tickets")]
public async Task<IActionResult> GetKitchenTickets(Guid shopId, [FromQuery] string status = "pending")
{
var merchantId = await GetCurrentMerchantIdAsync();
if (merchantId == null) return Ok(Array.Empty<object>());
@@ -1726,8 +1726,8 @@ public class BffDataController : ControllerBase
// ═══ RECIPES CRUD (catalog_service) ═══
[HttpGet("recipes")]
public async Task<IActionResult> GetRecipes([FromQuery] Guid? shopId = null)
[HttpGet("shops/{shopId}/recipes")]
public async Task<IActionResult> GetRecipes(Guid shopId)
{
var merchantId = await GetCurrentMerchantIdAsync();
if (merchantId == null) return Ok(Array.Empty<object>());