fix nan error
This commit is contained in:
@@ -689,7 +689,7 @@ export const mockDataInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
}
|
||||
|
||||
// ── GET /category/:id (items for a category)
|
||||
const catItemsMatch = url.match(/\/category\/(\d+)$/);
|
||||
const catItemsMatch = url.match(/\/category\/(\d+)(?:\?|$)/);
|
||||
if (catItemsMatch && req.method === 'GET') {
|
||||
const catId = parseInt(catItemsMatch[1], 10);
|
||||
const items = getItemsByCategoryId(catId);
|
||||
@@ -697,7 +697,7 @@ export const mockDataInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
}
|
||||
|
||||
// ── GET /item/:id
|
||||
const itemMatch = url.match(/\/item\/(\d+)$/);
|
||||
const itemMatch = url.match(/\/item\/(\d+)(?:\?|$)/);
|
||||
if (itemMatch && req.method === 'GET') {
|
||||
const itemId = parseInt(itemMatch[1], 10);
|
||||
const item = MOCK_ITEMS.find(i => i.itemID === itemId);
|
||||
@@ -756,7 +756,7 @@ export const mockDataInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
}
|
||||
|
||||
// ── POST /items/:id/callback (review)
|
||||
if (url.match(/\/items\/\d+\/callback$/) && req.method === 'POST') {
|
||||
if (url.match(/\/items\/\d+\/callback(?:\?|$)/) && req.method === 'POST') {
|
||||
return respond({ message: 'Review submitted (mock)' }, 200);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user