Fix UI for inventory page 3
This commit is contained in:
@@ -172,15 +172,23 @@ export class InventoryService {
|
||||
ingredientId?: string,
|
||||
limit: number = 50,
|
||||
offset: number = 0
|
||||
): Promise<PaginatedResponse<StockMovementResponse>> {
|
||||
): Promise<StockMovementResponse[]> {
|
||||
const queryParams = new URLSearchParams();
|
||||
if (ingredientId) queryParams.append('ingredient_id', ingredientId);
|
||||
queryParams.append('limit', limit.toString());
|
||||
queryParams.append('offset', offset.toString());
|
||||
queryParams.append('skip', offset.toString()); // Backend expects 'skip' not 'offset'
|
||||
|
||||
return apiClient.get<PaginatedResponse<StockMovementResponse>>(
|
||||
`${this.baseUrl}/${tenantId}/stock/movements?${queryParams.toString()}`
|
||||
);
|
||||
const url = `${this.baseUrl}/${tenantId}/stock/movements?${queryParams.toString()}`;
|
||||
console.log('🔍 Frontend calling API:', url);
|
||||
|
||||
try {
|
||||
const result = await apiClient.get<StockMovementResponse[]>(url);
|
||||
console.log('✅ Frontend API response:', result);
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('❌ Frontend API error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Expiry Management
|
||||
|
||||
Reference in New Issue
Block a user