fix(web): unwrap {data} envelope in getNeighborhoodScore (TEC-3093)
apiClient.get returns the raw JSON body { data, cacheMeta }, so callers
were storing the envelope in state and reading totalScore as undefined,
crashing ListingDetailClient via undefined.toFixed(1).
Unwrap .data inside getNeighborhoodScore so consumers receive the bare
NeighborhoodScoreResult as the existing type expects.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -298,7 +298,9 @@ export const listingsApi = {
|
||||
apiClient.get<ListingSimilarItem[]>(`/listings/${listingId}/similar?limit=${limit}`),
|
||||
|
||||
getNeighborhoodScore: (district: string, city: string = 'Hồ Chí Minh') =>
|
||||
apiClient.get<NeighborhoodScoreResult>(
|
||||
`/analytics/neighborhoods/${encodeURIComponent(district)}/score?city=${encodeURIComponent(city)}`,
|
||||
),
|
||||
apiClient
|
||||
.get<{ data: NeighborhoodScoreResult }>(
|
||||
`/analytics/neighborhoods/${encodeURIComponent(district)}/score?city=${encodeURIComponent(city)}`,
|
||||
)
|
||||
.then((res) => res.data),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user